private static License SaveAndReloadFromDisk(License license) { using (var path = new TemporaryFile()) { LicenseWriter.ToFile(path, license); return(LicenseReader.FromFile(path)); } }
public void ValidForMinorHardwareChanges() { using (var temp = new TemporaryFile()) { var contact = ContactFactory.Create <ContactForSlightlyChangedHardware>(); var license = LicenseFactory.Create <License>(contact); LicenseWriter.ToFile(temp, license); license = LicenseReader.FromFile <LicenseWithSlightlyChangedHardware, IniLicenseTextConverter <LicenseWithSlightlyChangedHardware> >(temp); Assert.IsTrue(license.IsValid()); } }
public void InvalidIfHardwareConfigurationChanged() { using (var temp = new TemporaryFile()) { var contact = ContactFactory.Create <Contact>(); var license = LicenseFactory.Create <License>(contact); LicenseWriter.ToFile(temp, license); license = LicenseReader.FromFile <LicenseWithChangedHardware, IniLicenseTextConverter <LicenseWithChangedHardware> >(temp); Assert.IsFalse(license.IsValid()); } }
public void SelfIssuedLicense() { using (var temp = new TemporaryFile()) { var contact = ContactFactory.Create <Contact>(); var license = LicenseFactory.Create <License>(contact); LicenseWriter.ToFile(temp, license); license = LicenseReader.FromFile(temp); Assert.IsTrue(license.IsValid()); } }