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)); } }
public void Creating_an_EnumComparer() { "When creating a EnumComperer" .When(() => SUT = new EnumComparison()); "it should implement IComparer" .Then(() => SUT.ShouldBeTypeOf<IComparison>()); }
public void Can_compare_types(Type type1, Type type2, bool expected) { "Given a Fixture" .Given(() => Fixture = new Fixture()); "And an EnumComparer" .And(() => SUT = Fixture.Create<EnumComparison>()); "When calling CanCompare({0}, {1})" .When(() => CanCompareResult = SUT.CanCompare(type1, type2)); "It should return {2}" .Then(() => CanCompareResult.ShouldBe(expected)); }