Пример #1
0
        public void CompareDifferentPeopleOfTheSameSize_ReturnsExpectedResult()
        {
            //Arrange
            var rightPerson = new Person()
            {
                Name = "Rafa", Age = 18, City = "Denver", Profession = "Dev"
            };
            var leftPerson = new Person()
            {
                Name = "Rafa", Age = 28, City = "Berlin", Profession = "Dev"
            };
            var expectedDifferences = new List <string>()
            {
                "age", "city"
            };
            var expectedResult = new DiffResult()
            {
                AreEqual    = false,
                AreSameSize = true,
                Differences = expectedDifferences
            };

            //Act
            var actualResult = PeopleComparerHelper.Compare(rightPerson, leftPerson);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Пример #2
0
        public void CompareNullPeople_ReturnsNull()
        {
            //Act
            var actualResult = PeopleComparerHelper.Compare(null, null);

            //Assert
            Assert.IsNull(actualResult);
        }
Пример #3
0
        public void CompareWithNull_ReturnsNull()
        {
            //Arrange
            var rightPerson = new Person()
            {
                Name = "Rafa", Age = 18, City = "Denver", Profession = "Dev"
            };

            //Act
            var actualResult = PeopleComparerHelper.Compare(rightPerson, null);

            //Assert
            Assert.IsNull(actualResult);
        }
Пример #4
0
        public void ComparePeopleWithDifferentSizes_ReturnsExpectedResult()
        {
            //Arrange
            var rightPerson = new Person()
            {
                Name = "Rafa", City = "Berlin", Profession = "Dev"
            };
            var leftPerson = new Person()
            {
                Name = "Rafa", Age = 28, City = "Berlin", Profession = "Dev"
            };
            var expectedResult = new DiffResult()
            {
                AreEqual = false, AreSameSize = false
            };

            //Act
            var actualResult = PeopleComparerHelper.Compare(rightPerson, leftPerson);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }