public void AddDifference(Difference difference) { Differences.Add(difference); }
public void Comparing_values(object value1, object value2, ComparisonResult expected) { "Given a Fixture" .Given(() => Fixture = new Fixture()); "And an EnumComparer" .And(() => SUT = Fixture.Create<EnumComparison>()); "And a Comparison context object" .And(() => { Context = new ComparisonContext("Property"); }); "When calling Compare({0}, {1})" .When(() => Result = SUT.Compare(Context, value1, value2)); "Then it should return {2}" .Then(() => Result.ShouldBe(expected)); if (expected == ComparisonResult.Pass) { "And it should not add any differences" .And(() => Context.Differences.Count.ShouldBe(0)); } else { var expectedDifference = new Difference { Breadcrumb = "Property", Value1 = value1, Value2 = value2 }; "And it should add a differences" .And(() => Context.Differences[0].ShouldBe(expectedDifference)); } }