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"); }
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"); }
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"); } }