示例#1
0
 private static License SaveAndReloadFromDisk(License license)
 {
     using (var path = new TemporaryFile())
     {
         LicenseWriter.ToFile(path, license);
         return(LicenseReader.FromFile(path));
     }
 }
示例#2
0
        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());
            }
        }
示例#3
0
        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());
            }
        }
示例#4
0
        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());
            }
        }