Exemple #1
0
        public void CopyTo_Default_Nop()
        {
            var attributeCollection = new SubAttributeCollection();
            var array = new object[] { 1, 2, 3 };

            if (!PlatformDetection.IsFullFramework)
            {
                attributeCollection.CopyTo(array, 1);
            }
            else
            {
                Assert.Throws <NullReferenceException>(() => attributeCollection.CopyTo(array, 1));
            }
            Assert.Equal(new object[] { 1, 2, 3 }, array);
        }
        public void CopyTo_InvokeNotEmpty_Success()
        {
            var attribute1 = new BrowsableAttribute(true);
            var attribute2 = new ReadOnlyAttribute(true);
            var collection = new SubAttributeCollection(attribute1, attribute2);

            var array = new object[] { 1, 2, 3 };

            collection.CopyTo(array, 0);
            Assert.Equal(new object[] { attribute1, attribute2, 3 }, array);

            array = new object[] { 1, 2, 3 };
            collection.CopyTo(array, 1);
            Assert.Equal(new object[] { 1, attribute1, attribute2 }, array);
        }
        public void CopyTo_Default_Nop()
        {
            var attributeCollection = new SubAttributeCollection();
            var array = new object[] { 1, 2, 3 };

            attributeCollection.CopyTo(array, 1);
            Assert.Equal(new object[] { 1, 2, 3 }, array);
        }
        public void CopyTo_InvokeEmpty_Success(int index)
        {
            var collection = new SubAttributeCollection();
            var array      = new object[] { 1, 2, 3 };

            collection.CopyTo(array, index);
            Assert.Equal(new object[] { 1, 2, 3 }, array);
        }
        public void CopyTo_NullArray_ThrowsArgumentNullException()
        {
            var collection = new SubAttributeCollection();

            Assert.Throws <ArgumentNullException>("destinationArray", () => collection.CopyTo(null, 0));
        }