Inheritance: Pkcs9AttributeObject
示例#1
0
 public static void DocumentDescriptionNullary()
 {
     Pkcs9DocumentDescription p = new Pkcs9DocumentDescription();
     Assert.Null(p.RawData);
     Assert.Null(p.DocumentDescription);
     string oid = p.Oid.Value;
     Assert.Equal(s_OidDocumentDescription, oid);
 }
		public void Constructor_Empty ()
		{
			Pkcs9DocumentDescription dd = new Pkcs9DocumentDescription ();
			Assert.AreEqual ("1.3.6.1.4.1.311.88.2.2", dd.Oid.Value, "Oid.Value");
			Assert.IsNull (dd.Oid.FriendlyName, "Oid.FriendlyName");
			Assert.IsNull (dd.RawData, "RawData");
			Assert.IsNull (dd.DocumentDescription, "DocumentDescription");
			Assert.AreEqual (String.Empty, dd.Format (true), "Format(true)");
			Assert.AreEqual (String.Empty, dd.Format (false), "Format(false)");
		}
		public void Constructor_String () 
		{
			Pkcs9DocumentDescription dd = new Pkcs9DocumentDescription ("mono");
			Assert.AreEqual ("1.3.6.1.4.1.311.88.2.2", dd.Oid.Value, "Oid.Value");
			Assert.IsNull (dd.Oid.FriendlyName, "Oid.FriendlyName");
			Assert.AreEqual ("mono", dd.DocumentDescription, "DocumentDescription");
			Assert.AreEqual (12, dd.RawData.Length, "RawData.Length");
			Assert.AreEqual ("04-0A-6D-00-6F-00-6E-00-6F-00-00-00", BitConverter.ToString (dd.RawData), "RawData");
			Assert.AreEqual ("04 0a 6d 00 6f 00 6e 00 6f 00 00 00", dd.Format (true), "Format(true)");
			Assert.AreEqual ("04 0a 6d 00 6f 00 6e 00 6f 00 00 00", dd.Format (false), "Format(false)");
		}
		public void Constructor_ArrayNull ()
		{
			byte[] desc = null;
			Pkcs9DocumentDescription dd = new Pkcs9DocumentDescription (desc);
		}
		public void Constructor_StringNull () 
		{
			string desc = null;
			Pkcs9DocumentDescription dd = new Pkcs9DocumentDescription (desc);
		}
示例#6
0
 public static void DocumentDescriptionFromRawData()
 {
     byte[] rawData = "041e4d00790020004400650073006300720069007000740069006f006e000000".HexToByteArray();
     Pkcs9DocumentDescription p = new Pkcs9DocumentDescription(rawData);
     Assert.Equal(rawData, p.RawData);
     string cookedData = p.DocumentDescription;
     Assert.Equal("My Description", cookedData);
     string oid = p.Oid.Value;
     Assert.Equal(s_OidDocumentDescription, oid);
 }
示例#7
0
 public static void DocumentDescriptionNullValue()
 {
     object ignore;
     Assert.Throws<ArgumentNullException>(() => ignore = new Pkcs9DocumentDescription((string)null));
 }
示例#8
0
        public static void DocumentDescriptionFromCookedData()
        {
            Pkcs9DocumentDescription p = new Pkcs9DocumentDescription("My Description");
            string oid = p.Oid.Value;
            Assert.Equal(s_OidDocumentDescription, oid);

            Pkcs9DocumentDescription p2 = new Pkcs9DocumentDescription(p.RawData);
            string cookedData = p2.DocumentDescription;
            Assert.Equal("My Description", cookedData);
        }