@@ -37,8 +37,8 @@ public class LicensingTests
37
37
const string TestText2013Text = "1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBUZXh0LFR5cGU6VGV4dEluZGllLEhhc2g6V3liaFpUejZiMWgxTGhCcmRRSzlNc09FVUsya3Z6Z2E5VDBaRCtEWnlBd0JxM1dabVFVanNaelgwTWR5OXJMSTlmbzJ0dVVOMk9iZ2srcmswdVZGeit6Q1dreTk3SFE5OHhkOGtDRkx0LzQxR2RiU054SnFIVUlmR1hMdS9CQTVOR0lKanN3SjhXTjdyY0R0VmYyTllKK2dEaFd1RzZ4cnB1ZXhYa01WSXFrPSxFeHBpcnk6MjAxMy0wMS0wMX0=" ;
38
38
readonly LicenseKey TestText2013 = new LicenseKey { Ref = "1001" , Name = "Test Text" , Type = LicenseType . TextIndie , Expiry = new DateTime ( 2013 , 01 , 01 ) } ;
39
39
40
- const string TestTrial2000Text = "TRIAL302000-e1JlZjpUUklBTDMwMjAwMCxOYW1lOlRyaWFsIFRlc3QsVHlwZTpUcmlhbCxIYXNoOm4vOGhCQmk3cjFBSmV3WmNwaksyYXJBaDhObHBvRFVNR1ExZjNocmFwaERDNm5zRjY1azJ6bUI2b2xwblhtdHVVdFhNUEoxQ1prOVdWWVlNdjcrTnU3VVk0bS9CV091R1RNb2FxaUU2QWExRGpjRW91NDZHRy83c0tQeGVJcXcxK01XZXdFdm96TTRBWDhhZEs0dEEwZGF6a1dnVjZYMVJBK2tzZDVWZTZvcz0sRXhwaXJ5OjIwMDAtMDEtMDF9 " ;
41
- readonly LicenseKey TestTrial2000 = new LicenseKey { Ref = "TRIAL302000 " , Name = "Trial Test" , Type = LicenseType . Trial , Expiry = new DateTime ( 2000 , 01 , 01 ) } ;
40
+ const string TestTrial2001Text = "TRIAL302001-e1JlZjpUUklBTDMwMjAwMSxOYW1lOlRyaWFsIFRlc3QsVHlwZTpUcmlhbCxIYXNoOlRGRlNVQTRHYWtiY2tmYlpsOHpsbXhVZUpLZ0pORkxaQ1pJckxwSEJpdTVtSXAzWEx4NGFmd0ZGa2duYzNkZTlUUjczR3hKdVdjMkVnQXF0dzdERVNxVWQwOTBFQ09UOXZ3eGNsMjR4V3BXSkwvM1A5TW1RN283bGp1ckJzV2wvL3AzVFpXajlmeTIzcVA0T3B5YmEzTzhLcmhoTXNnZ3k3c0dGL0JOVmdjbz0sRXhwaXJ5OjIwMDEtMDEtMDF9 " ;
41
+ readonly LicenseKey TestTrial2001 = new LicenseKey { Ref = "TRIAL302001 " , Name = "Trial Test" , Type = LicenseType . Trial , Expiry = new DateTime ( 2001 , 01 , 01 ) } ;
42
42
const string TestTrial2016Text = "TRIAL302016-e1JlZjpUUklBTDMwMjAxNixOYW1lOlRyaWFsIFRlc3QsVHlwZTpUcmlhbCxIYXNoOkFSSThkVzlHZ210NWZGZ09MTytIRi9vQ29iOWgwN1c4bGxuNHZrUm9CQ2M5aysxVlh3WWJEd2Nxais3cHhFbEwrTkgwbGF2NXoyZGdJV1NndUpXYjZrUC9aQWdqNVIvMmlHamp4ZlduQjExOWY2WHgvRzFERmQ5cndJdjNMejhzR0V5RitNcGhlN3RTbEhJVlR4UjA1amI2SDFaZHlIYjNDNFExcTJaWEFzQT0sRXhwaXJ5OjIwMTYtMDEtMDF9" ;
43
43
readonly LicenseKey TestTrial2016 = new LicenseKey { Ref = "TRIAL302016" , Name = "Trial Test" , Type = LicenseType . Trial , Expiry = new DateTime ( 2016 , 01 , 01 ) } ;
44
44
@@ -157,16 +157,39 @@ public void Expired_licenses_throws_LicenseException()
157
157
158
158
try
159
159
{
160
- Licensing . RegisterLicense ( TestTrial2000Text ) ;
160
+ Licensing . RegisterLicense ( TestTrial2001Text ) ;
161
161
Assert . Fail ( "Should throw Expired LicenseException" ) ;
162
162
}
163
163
catch ( LicenseException ex )
164
164
{
165
165
ex . Message . Print ( ) ;
166
- Assert . That ( ex . Message , Is . StringStarting ( "This license has expired" ) ) ;
166
+ Assert . That ( ex . Message , Is . StringStarting ( "This trial license has expired" ) ) ;
167
167
}
168
168
}
169
169
170
+ [ Test ]
171
+ public void Can_deserialize_all_license_key ( )
172
+ {
173
+ AssertKey ( TestBusiness2000Text , TestBusiness2000 ) ;
174
+ AssertKey ( TestIndie2000Text , TestIndie2000 ) ;
175
+ AssertKey ( TestBusiness2013Text , TestBusiness2013 ) ;
176
+ AssertKey ( TestIndie2013Text , TestIndie2013 ) ;
177
+ AssertKey ( TestText2013Text , TestText2013 ) ;
178
+ AssertKey ( TestTrial2001Text , TestTrial2001 ) ;
179
+ AssertKey ( TestTrial2016Text , TestTrial2016 ) ;
180
+ }
181
+
182
+ private void AssertKey ( string licenseKeyText , LicenseKey expectedKey )
183
+ {
184
+ var licenseKey = licenseKeyText . ToLicenseKey ( ) ;
185
+
186
+ Assert . That ( licenseKey . Ref , Is . EqualTo ( expectedKey . Ref ) ) ;
187
+ Assert . That ( licenseKey . Name , Is . EqualTo ( expectedKey . Name ) ) ;
188
+ Assert . That ( licenseKey . Type , Is . EqualTo ( expectedKey . Type ) ) ;
189
+ //Assert.That(licenseKey.Hash, Is.EqualTo(expectedKey.Hash));
190
+ Assert . That ( licenseKey . Expiry , Is . EqualTo ( expectedKey . Expiry ) ) ;
191
+ }
192
+
170
193
[ Explicit , Test ]
171
194
public void Test_dynamically_loaded_assemblies ( )
172
195
{
0 commit comments