Пример #1
0
        public void ParseExact()
        {
            Assert.IsInstanceOfType(Comb.ParseExact("{0x3e3a6e75,0x0100,0x0f45,{0xae,0x41,0xa3,0xe3,0xd2,0x53,0x6a,0x57}}", "X"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("{0x3E3A6E75,0x0100,0x0F45,{0xAE,0x41,0xA3,0xE3,0xD2,0x53,0x6A,0x57}}", "x"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("3e3a6e7501000f45ae41a3e3d2536a57", "N"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("3e3a6e7501000f45ae41a3e3d2536a57", "n"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("3e3a6e75-0100-0f45-ae41-a3e3d2536a57", "D"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("3e3a6e75-0100-0f45-ae41-a3e3d2536a57", "d"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("3e3a6e75-0100-0f45-ae41-a3e3d2536a57", ""), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("{3e3a6e75-0100-0f45-ae41-a3e3d2536a57}", "B"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("{3e3a6e75-0100-0f45-ae41-a3e3d2536a57}", "b"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("(3e3a6e75-0100-0f45-ae41-a3e3d2536a57)", "P"), typeof(Comb));
            Assert.IsInstanceOfType(Comb.ParseExact("(3e3a6e75-0100-0f45-ae41-a3e3d2536a57)", "p"), typeof(Comb));

            ExceptionAssert.Throws <ArgumentNullException>(() => Comb.Parse(null));
            ExceptionAssert.Throws <FormatException>(() => Comb.Parse("(00000000000000000000000000000000)"));
            ExceptionAssert.Throws <FormatException>(() => Comb.ParseExact("3e3a6e75-0100-0f45-ae41a3e3d2536a57", "x"));
        }