예제 #1
0
        public void Test07_Gen2ParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key    gkey;
                string finalkey;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvppppxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "1");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "2");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
예제 #2
0
        public void Test16_Gen5DisParB16BitChk155555()
        {
            int lopcnt;

            try
            {
                Key    gkey;
                string finalkey;
                string result;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvvvvvppppxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-ssssssssxxxxxxxxxxxx-xxxxxxxxxxxxcccccccc-xxxxxxxxxxxxxxxxrrrr", Checksum.ChecksumType.Type1);
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "14");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "2");
                    gkey.AddToken(2, "w", Key.TokenTypes.Number, "6");
                    gkey.AddToken(3, "s", Key.TokenTypes.Number, "BC");
                    gkey.AddToken(4, "r", Key.TokenTypes.Number, "5");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                    result = gkey.DisassembleKey("v");
                    if (result != "14")
                    {
                        throw new Exception("The first tokens are not equal");
                    }
                    result = gkey.DisassembleKey("p");
                    if (result != "2")
                    {
                        throw new Exception("The second tokens are not equal");
                    }
                    result = gkey.DisassembleKey("w");
                    if (result != "6")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("s");
                    if (result != "BC")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("r");
                    if (result != "5")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
예제 #3
0
 public void Test10_8_Gen3ParB16Bit55555()
 {
     try
     {
         int lopcnt;
         for (lopcnt = 1; lopcnt < 30; lopcnt++)
         {
             var gkey = new Key("vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
             gkey.AddToken(new SimpleToken('v', 1));
             gkey.AddToken(new SimpleToken('p', 2));
             gkey.AddToken(new SimpleToken('w', "QR"));
             var finalkey = gkey.CreateKey();
             if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4))
             {
                 throw new Exception("Keys are not the same length");
             }
         }
     }
     catch (Exception e)
     {
         Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
     }
 }
예제 #4
0
        public void Test17_Gen5DisParB16BitChk255555()
        {
            int lopcnt;

            try
            {
                string result;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    var gkey = new Key("vvvvvvvvppppxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-ssssssssxxxxxxxxxxxx-xxxxxxxxxxxxcccccccc-xxxxxxxxxxxxxxxxrrrr", Checksum.ChecksumType.Type2);
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "34");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "6");
                    gkey.AddToken(2, "w", Key.TokenTypes.Number, "8");
                    gkey.AddToken(3, "s", Key.TokenTypes.Number, "AB");
                    gkey.AddToken(4, "r", Key.TokenTypes.Number, "3");
                    var finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                    result = gkey.DisassembleKey("v");
                    if (result != "34")
                    {
                        throw new Exception("The first tokens are not equal");
                    }
                    result = gkey.DisassembleKey("p");
                    if (result != "6")
                    {
                        throw new Exception("The second tokens are not equal");
                    }
                    result = gkey.DisassembleKey("w");
                    if (result != "8")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("s");
                    if (result != "AB")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("r");
                    if (result != "3")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
예제 #5
0
        public void Test14_Gen3DisParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;
                string result;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvppppxxxxxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "1");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "2");
                    gkey.AddToken(2, "w", Key.TokenTypes.Number, "6");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                    result = gkey.DisassembleKey("v");
                    if (result != "1")
                    {
                        throw new Exception("The first tokens are not equal");
                    }
                    result = gkey.DisassembleKey("p");
                    if (result != "2")
                    {
                        throw new Exception("The second tokens are not equal");
                    }
                    result = gkey.DisassembleKey("w");
                    if (result != "6")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
예제 #6
0
        public void Test10_Gen3ParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "1");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "2");
                    gkey.AddToken(2, "w", Key.TokenTypes.Character, "QR");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
예제 #7
0
 public void Test10_8_Gen3ParB16Bit55555()
 {
     try
     {
         int lopcnt;
         for (lopcnt = 1; lopcnt < 30; lopcnt++)
         {
             var gkey = new Key("vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
             gkey.AddToken(new SimpleToken('v', 1));
             gkey.AddToken(new SimpleToken('p', 2));
             gkey.AddToken(new SimpleToken('w', "QR"));
             var finalkey = gkey.CreateKey();
             if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4))
             {
                 throw new Exception("Keys are not the same length");
             }
         }
     }
     catch (Exception e)
     {
         Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
     }
 }
예제 #8
0
        public void Test0_5_Gen2ParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvvvvvppppxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(new SimpleToken('v', "11"));
                    gkey.AddToken(new SimpleToken('p', "2"));
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }