public void HasTheSameItems_ReturnsTrue_ForExactSameCollectionsOfObjects()
        {
            //Arrange.
            List <ContainerUnitTestEntity> a = new List <ContainerUnitTestEntity>();
            List <ContainerUnitTestEntity> b = new List <ContainerUnitTestEntity>();

            ContainerUnitTestEntity objA = new ContainerUnitTestEntity {
                Id = 1, Value = "a"
            };
            ContainerUnitTestEntity objB = new ContainerUnitTestEntity {
                Id = 2, Value = "b"
            };

            //Act.
            a.Add(objA);
            a.Add(objB);

            b.Add(objA);
            b.Add(objB);

            //Assert.
            bool areEqual = a.HasTheSameItems(b);

            Assert.IsTrue(areEqual);
        }
        public void HasEqualItemsInTheSameOrder_ReturnsFalse_IfArrayAreOfDifferentLength()
        {
            //Arrange.
            ContainerUnitTestEntity[] a = new ContainerUnitTestEntity[3];
            ContainerUnitTestEntity[] b = new ContainerUnitTestEntity[4];

            //Act.
            bool areEqual = a.HasEqualItemsInTheSameOrder(b);

            //Assert.
            Assert.IsFalse(areEqual);
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj.GetType() != typeof(ContainerUnitTestEntity))
            {
                return(false);
            }

            ContainerUnitTestEntity compared = (ContainerUnitTestEntity)obj;

            if ((compared.Id) != Id)
            {
                return(false);
            }
            if (!compared.Value.Equals(Value))
            {
                return(false);
            }
            return(true);
        }
        public void HasEqualItemsInTheSameOrder_ReturnsTrue_IfAllItemsAreEqual()
        {
            //Arrange.
            ContainerUnitTestEntity[] a = new ContainerUnitTestEntity[3];
            a[0] = new ContainerUnitTestEntity()
            {
                Id = 1, Value = "a"
            };
            a[1] = new ContainerUnitTestEntity()
            {
                Id = 2, Value = "b"
            };
            a[2] = new ContainerUnitTestEntity()
            {
                Id = 3, Value = "c"
            };

            ContainerUnitTestEntity[] b = new ContainerUnitTestEntity[3];
            b[0] = new ContainerUnitTestEntity()
            {
                Id = 1, Value = "a"
            };
            b[1] = new ContainerUnitTestEntity()
            {
                Id = 2, Value = "b"
            };
            b[2] = new ContainerUnitTestEntity()
            {
                Id = 3, Value = "c"
            };

            //Act.
            bool areEqual = a.HasEqualItemsInTheSameOrder(b);

            //Assert.
            Assert.IsTrue(areEqual);
        }
        public void HasEqualItemsInTheSameOrder_ReturnsFalse_IfHaveAllTheSameButOneArrayHasEmptySlotAtEnd()
        {
            //Arrange.
            ContainerUnitTestEntity[] a = new ContainerUnitTestEntity[3];
            a[0] = new ContainerUnitTestEntity()
            {
                Id = 1, Value = "a"
            };
            a[1] = new ContainerUnitTestEntity()
            {
                Id = 2, Value = "b"
            };
            a[2] = new ContainerUnitTestEntity()
            {
                Id = 3, Value = "c"
            };

            ContainerUnitTestEntity[] b = new ContainerUnitTestEntity[4];
            b[0] = new ContainerUnitTestEntity()
            {
                Id = 1, Value = "a"
            };
            b[1] = new ContainerUnitTestEntity()
            {
                Id = 2, Value = "b"
            };
            b[2] = new ContainerUnitTestEntity()
            {
                Id = 3, Value = "c"
            };

            //Act.
            bool areEqual = a.HasEqualItemsInTheSameOrder(b);

            //Assert.
            Assert.IsFalse(areEqual);
        }