public void IncludeSelf_sets_Wrapped_IncludeSelfInEnumeration_true() { // Arrange var wrapped = new DummyTestComposite<ClassToTest>(); wrapped.IncludeSelfInEnumeration = false; var sut = MakeSut(wrapped); // Act sut.IncludeSelf("no reason"); // Assert Assert.True(wrapped.IncludeSelfInEnumeration); }
public void From_returns_wrapper_around_factory_Root() { // Arrange var sut = MakeSut(); var returnedRoot = new DummyTestComposite<ClassToTest>(); sut.StubbedRoot = (desc, setup) => returnedRoot; // Act var actual = sut.From<ClassToTest>("initial", () => new ClassToTest(5)); // Assert Assert.IsType<TestRootFluentWrapper<ClassToTest>>(actual); var asWrapper = actual as TestRootFluentWrapper<ClassToTest>; Assert.Same(returnedRoot, asWrapper.Wrapped); // took the root from Factory class }
public void Arrange_returns_result_of_applying_mutation_to_parent_Arrange() { // Arrange var parentArrangement = new ClassToTest(4); var theParent = new DummyTestComposite<ClassToTest>(); theParent.StubbedArrange = () => parentArrangement; var theMutation = new DummyMutation<ClassToTest>(); ClassToTest itemPassedToMutationApply = null; theMutation.StubbedApply = d => itemPassedToMutationApply = d; var sut = MakeSut(theParent, theMutation); // Act var actual = sut.Arrange(); // Assert Assert.Same(parentArrangement, actual); Assert.Same(parentArrangement, itemPassedToMutationApply); }
public void Leaf_with_ConditionToTest_returns_a_TestLeaf_with_Arrange_from_parent_Arrange_AND_its_own() { // Arrange var sut = MakeSut(); var arrangeReturn = new ClassToTest(5); var parent = new DummyTestComposite<ClassToTest>(); parent.StubbedArrange = () => arrangeReturn; var mutationNewIntProperty = 666; var mutation = new DummyMutation<ClassToTest>(); mutation.StubbedApply = c => c.IntProperty = mutationNewIntProperty; var leaf = sut.Leaf(parent, mutation); // Act var actual = leaf.Arrange(); // Assert Assert.Same(arrangeReturn, actual); Assert.Equal(actual.IntProperty, mutationNewIntProperty); }
public void Description_returns_Parent_descriptions_AND_mutation_Description() { // Arrange var mutationDescription = "la super description"; var theMutation = new DummyMutation<ClassToTest>(mutationDescription); var parentDescription = "parent description"; var theParent = new DummyTestComposite<ClassToTest>(parentDescription); var sut = MakeSut(theParent, theMutation); var expectedDescription = parentDescription + " AND " + mutationDescription; // Act var actual = sut.Description; // Assert Assert.Equal(expectedDescription, actual); }