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