Пример #1
0
        public void Insert_NullValue_ThrowsArgumentNullException()
        {
            var attribute = new DirectoryAttribute();

            AssertExtensions.Throws <ArgumentNullException>("value", () => attribute.Insert(0, (string)null));
            AssertExtensions.Throws <ArgumentNullException>("value", () => attribute.Insert(0, (byte[])null));
            AssertExtensions.Throws <ArgumentNullException>("value", () => attribute.Insert(0, (Uri)null));
        }
Пример #2
0
        public void Insert_InvalidIndex_ThrowsArgumentOutOfRangeException(int index)
        {
            var attribute = new DirectoryAttribute {
                "value2"
            };

            AssertExtensions.Throws <ArgumentOutOfRangeException>("index", () => attribute.Insert(index, "value"));
            AssertExtensions.Throws <ArgumentOutOfRangeException>("index", () => attribute.Insert(index, new byte[] { 1, 2, 3 }));
            AssertExtensions.Throws <ArgumentOutOfRangeException>("index", () => attribute.Insert(index, new Uri("http://microsoft.com")));
        }
Пример #3
0
        public void Insert_MultipleTypes_Success()
        {
            var attribute = new DirectoryAttribute {
                "value2"
            };

            attribute.Insert(0, "value1");
            attribute.Insert(1, new byte[] { 1, 2, 3 });
            attribute.Insert(3, new Uri("http://microsoft.com"));

            Assert.Equal(new object[] { "value1", new byte[] { 1, 2, 3 }, "value2", new Uri("http://microsoft.com") }, attribute.Cast <object>());
        }