コード例 #1
0
            public void Calls_customization_when_values_are_equal(
                Mock <IEqualityCustomization> equalityCustomization,
                DummyValueObjectBuilder sutBuilder
                )
            {
                sutBuilder
                .WithEqualityCustomization(equalityCustomization.Object);

                var sut   = sutBuilder.Build();
                var other = sutBuilder.Build();

                equalityCustomization.Setup(x =>
                                            x.CheckEquality(sut, other))
                .Verifiable();

                var res = sut.Equals(other);

                equalityCustomization.Verify();
            }
コード例 #2
0
            public void Returns_the_customization_output_when_values_are_equals(
                bool customizationOutput,
                Mock <IEqualityCustomization> equalityCustomization,
                DummyValueObjectBuilder sutBuilder,
                DummyValueObjectBuilder otherBuilder
                )
            {
                sutBuilder
                .WithEqualityCustomization(equalityCustomization.Object);

                var sut   = sutBuilder.Build();
                var other = otherBuilder
                            .WithInt(sut.Int)
                            .WithString(sut.String)
                            .WithEqualityCustomization(equalityCustomization.Object)
                            .Build();

                equalityCustomization.Setup(x =>
                                            x.CheckEquality(sut, other))
                .Returns(customizationOutput);

                sut.Equals(other).Should().Be(customizationOutput);
            }