Beispiel #1
0
        public void CopyCollection_ToIsNull_DoesNothing()
        {
            // Arrange
            List <int> from = new List <int> {
                1, 2, 3
            };
            List <int> to = null;

            // Act
            ModelCopier.CopyCollection(from, to);

            // Assert
            Assert.Equal(new[] { 1, 2, 3 }, from.ToArray());
        }
Beispiel #2
0
        public void CopyCollection_ToIsNull_DoesNothing()
        {
            // Arrange
            List <int> from = new List <int>()
            {
                1, 2, 3
            };
            List <int> to = null;

            // Act
            ModelCopier.CopyCollection(from, to);

            // Assert
            CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, from);
        }
Beispiel #3
0
        public void CopyCollection_ToIsImmutable_DoesNothing()
        {
            // Arrange
            List <int> from = new List <int> {
                1, 2, 3
            };
            ICollection <int> to = new ReadOnlyCollection <int>(new[] { 4, 5, 6 });

            // Act
            ModelCopier.CopyCollection(from, to);

            // Assert
            Assert.Equal(new[] { 1, 2, 3 }, from.ToArray());
            Assert.Equal(new[] { 4, 5, 6 }, to.ToArray());
        }
Beispiel #4
0
        public void CopyCollection_ToIsMmutable_ClearsAndCopies()
        {
            // Arrange
            List <int> from = new List <int> {
                1, 2, 3
            };
            ICollection <int> to = new List <int> {
                4, 5, 6
            };

            // Act
            ModelCopier.CopyCollection(from, to);

            // Assert
            Assert.Equal(new[] { 1, 2, 3 }, from.ToArray());
            Assert.Equal(new[] { 1, 2, 3 }, to.ToArray());
        }