public void StandardLicenseTest() { Dictionary <string, string> values = StandardLicenseBuilder.Build("to-me", null, "*****@*****.**", "00200", 4); string licenseFolder = System.IO.Path.GetTempPath(); string fileName = "UTTest.lic"; string filePath = System.IO.Path.Combine(licenseFolder, fileName); using (System.IO.Stream fileStream = new System.IO.FileStream(filePath, FileMode.Create)) { LicenseWriter.Write(values, new TestSigner(), fileStream); } IStandardLicense license = new TestLicense(); Assert.That(license.Status, Is.EqualTo(LicenseStatus.NotLoaded)); license.Load(licenseFolder); Assert.That(license.Status, Is.EqualTo(LicenseStatus.Active)); Assert.That(license.LicensedTo, Is.EqualTo("to-me"), "wrong licensedto"); Assert.That(license.LicenseTitle, Is.EqualTo("Test License"), "wrong license title"); Assert.That(license.ExpirationDate, Is.Null, "Expiration date is not null"); Assert.That(license.AttributeSummary, Is.EqualTo("Attribs"), "wrong attribs"); Assert.That(license.SerialNumber, Is.EqualTo("00200"), "wrong serial number"); Assert.That(license.EmailAddress, Is.EqualTo("*****@*****.**"), "wrong email address"); Assert.That(license.LicenseVersion, Is.EqualTo(4), "wrong license version"); Assert.That(license.Values[StandardLicenseBuilder.EmailAddressKey], Is.EqualTo("*****@*****.**"), "bad dictionary"); }
public void StandardLicenseNotExpired() { Dictionary <string, string> values = StandardLicenseBuilder.Build("to-me", DateTime.Today.AddDays(1.0D), "*****@*****.**", "00200", 4); string licenseFolder = System.IO.Path.GetTempPath(); string fileName = "UTTest.lic"; string filePath = System.IO.Path.Combine(licenseFolder, fileName); using (System.IO.Stream fileStream = new System.IO.FileStream(filePath, FileMode.Create)) { LicenseWriter.Write(values, new TestSigner(), fileStream); } IStandardLicense license = new TestLicense(); Assert.That(license.Status, Is.EqualTo(LicenseStatus.NotLoaded)); license.Load(licenseFolder); Assert.That(license.Status, Is.EqualTo(LicenseStatus.Active)); Assert.That(license.LicensedTo, Is.EqualTo("to-me"), "wrong licensedto"); Assert.That(license.LicenseTitle, Is.EqualTo("Test License"), "wrong license title"); }