Exemplo n.º 1
0
        public void VerifyLongDerStringRoundTrip()
        {
            string TestString = new string('A', 64000);

            Assert.AreEqual(TestString, DerUtils.DecodeString(DerUtils.EncodePrintableString(TestString)), "PrintableString should make encoding round trip unchanged");
            Assert.AreEqual(TestString, DerUtils.DecodeString(DerUtils.EncodeBMPString(TestString)), "BMPString should make encoding round trip unchanged");
        }
Exemplo n.º 2
0
        public void VerifyDerBMPStringRoundTrip()
        {
            const string TestString = "this string has unicode in the range handled by BMPString \u03d5";

            Assert.AreEqual(TestString, DerUtils.DecodeBMPString(DerUtils.EncodeBMPString(TestString)), "string should make encoding round trip unchanged");

            Assert.AreEqual(string.Empty, DerUtils.DecodeBMPString(DerUtils.EncodeBMPString(string.Empty)), "empty string should make encoding round trip unchanged");
        }
Exemplo n.º 3
0
        public void VerifyDerEncodeStringNullCases()
        {
            Action[] testCases = new Action[]
            {
                () => DerUtils.EncodePrintableString(null),
                () => DerUtils.EncodeBMPString(null),
            };

            foreach (Action test in testCases)
            {
                bool caught = false;
                try
                {
                    test();
                }
                catch (ArgumentNullException)
                {
                    caught = true;
                }

                Assert.IsTrue(caught, "expected an ArgumentNullException");
            }
        }