public void TestVerifier_Full() { var expireDate = DateTime.Parse("2100-01-01", CultureInfo.InvariantCulture); var license = Lic.Builder .WithRsaPrivateKey(LicTest.PrivateKey) .WithHardwareIdentifier(HardwareIdentifier.ForCurrentComputer()) .WithSerialNumber(SerialNumber.Create("ABC")) .ExpiresOn(expireDate) .WithProperty("Prop1", "Value1") .WithProperty("Prop2", "Value2") .SignAndCreate(); var verifiedLicense = Lic.Verifier .WithRsaPublicKey(LicTest.PublicKey) .WithApplicationCode("ABC") .LoadAndVerify(license.Serialize()); Assert.AreEqual(license.Serialize(), verifiedLicense.Serialize()); verifiedLicense = Lic.Verifier .WithRsaPublicKey(LicTest.PublicKey) .WithApplicationCode("ABC") .LoadAndVerify(license.SerializeAsPlainText()); Assert.AreEqual(license.Serialize(), verifiedLicense.Serialize()); }
private static IProcess BuildModuleProcess(ICatalogItemBuilder builder) { var moduleHelper = builder.GetHighLevelHelper <IModuleHighLevelHelper>(); var productIdentifier = new HardwareIdentifier(HardwareIdentifier.NiVendorName, "Rebar Module"); var module = moduleHelper.CreateRoot(ModuleKind.Name, "Rebar Module", LocalName, productIdentifier); return(module); }
public void TestVerify_OneMatchingParts() { var hardwareID = HardwareIdentifier.ForCurrentComputer(); var splitted = hardwareID.Split('-'); var otherID = string.Format("1234567890-0987654321-3010203045-" + splitted[3] + "-DummycheckSum"); Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer(otherID)); }
public void TestVerify_ThreeMatchingParts() { var hardwareID = HardwareIdentifier.ForCurrentComputer(); var splitted = hardwareID.Split('-'); var otherID = string.Format("12345678-" + splitted[1] + "-" + splitted[2] + "-" + splitted[3] + "-DummycheckSum"); Assert.IsTrue(HardwareIdentifier.IsValidForCurrentComputer(otherID)); }
public void Test_hardware_identifier_structure() { var hardwareID = HardwareIdentifier.ForCurrentComputer(); var split = hardwareID.Split('-'); Assert.AreEqual(5, split.Length); Assert.AreEqual(8, split[0].Length); Assert.AreEqual(8, split[1].Length); Assert.AreEqual(8, split[2].Length); Assert.AreEqual(8, split[3].Length); Assert.AreEqual(4, split[4].Length); }
public void Test_verify() { var hardwareID = HardwareIdentifier.ForCurrentComputer(); Assert.IsTrue(HardwareIdentifier.IsValidForCurrentComputer(hardwareID)); }
public void Test_verify_crap_string() => Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer("dsfdsaf<df"));
public void Test_verify_empty_string() { Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer("")); }
public void Test_verify_null() => TestHelper.AssertException <ArgumentNullException>(() => HardwareIdentifier.IsValidForCurrentComputer(null));
public void TestArePartialEqual_TwoTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-123", "ABC-DEF-123"));
public void TestVerify_ZeroMatchingParts() => Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer("12345678-09876543-09876543-12345678-0987"));
public void TestArePartialEqual_FiveFalse2() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-MNO-123", "AAA-DDD-GGG-JJJ-MMM-123"));
public void TestArePartialEqual_FiveTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-MNO-123", "ABC-DEF-GHI-JJJ-MMM-123"));
public void TestArePartialEqual_FourFalse1() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DDD-GGG-JJJ-345"));
public void TestArePartialEqual_FourTrue1() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DEF-GHI-JKL-123"));
public void TestArePartialEqual_ThreeFalse2() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-123", "AAA-DDD-GGG-345"));
public void TestArePartialEqual_ThreeTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-123", "ABC-DEF-GGG-345"));
public void TestArePartialEqual_TwoFalse() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-123", "CCC-DDD-345"));
public void TestArePartialEqual_OneTrue() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-123", "ABC-345"));
public void TestArePartialEqual_Empty() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("", ""));
public void TestArePartialEqual_DifferentLength() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DEF-GHI-JKL"));
public void TestArePartialEqual_OneFalse() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-123", "DDD-345"));