public void SetUp() { "Given a fixture" .Given(() => { Fixture = new Fixture(); Fixture.Customize(new AutoMoqCustomization()); }); "And some mock comparers" .And(() => { Inner = Fixture.Freeze<IEnumerable<IComparison>>() .Select(Mock.Get) .ToList(); Inner.ForEach( m => m.Setup(c => c.CanCompare(It.IsAny<Type>(), It.IsAny<Type>())) .Returns(false)); Inner.ForEach( m => m.Setup(c => c.Compare(It.IsAny<IComparisonContext>(), It.IsAny<object>(), It.IsAny<object>())) .Returns(ComparisonResult.Inconclusive)); }); "And a CompositeComparer" .And(() => SUT = Fixture.Build<CompositeComparison>() .With(x => x.Comparisons) .Create()); }
public ComparisonBuilder() { CustomComparisons = new List <IComparison>(); Root = new CompositeComparison(); ComplexObjectComparison = new ComplexObjectComparison(Root); DefaultComparison = new DefaultComparison(); }
public ComparisonBuilder() { CustomComparisons = new List <IComparison>(); CustomFormatters = new Dictionary <Type, IDifferenceFormatter>(); Root = new CompositeComparison(); ComplexObjectComparison = new ComplexObjectComparison(Root); DefaultComparison = new DefaultComparison(); }
public void When_creating_a_CompositeComparer() { "When creating a CompostieComperer" .When(() => SUT = new CompositeComparison()); "it should implement IComparer" .Then(() => SUT.ShouldBeTypeOf<IComparison>()); "CanCompare should always true" .And(() => SUT.CanCompare(null, null).ShouldBe(true)); }
public void When_adding_a_caomparison() { "Given a CompostieComperer" .Given(() => SUT = new CompositeComparison()); "When adding a comparer" .Then(() => SUT.Add(Mock.Of<IComparison>())); "Then there should be one comparison" .Then(() => SUT.Comparisons.Count.ShouldBe(1)); }