コード例 #1
0
        public void ByRefUserDefinedType(UdtClass value1, UdtClass value2, ComparisonResult expectedResult)
        {
            //Arrange.
            PersonByRefUdt p1 = ModelsHelper.CreatePersonByRefUdt();

            p1.ByRefProperty = value1;
            PersonByRefUdt p2 = ModelsHelper.CreatePersonByRefUdt();

            p2.ByRefProperty = value2;
            ObjectComparer comparer = ObjectComparer.Create <PersonByRefUdt>();

            //Act.
            var result = comparer.Compare(p1, p2, out bool isDifferent);

            //Assert.
            isDifferent.Should().Be((expectedResult & ComparisonResult.NotEqual) == ComparisonResult.NotEqual);
            result[nameof(PersonByRefUdt.ByRefProperty)].Result.Should().Be(expectedResult);
        }