public void ComposeRetainsComparer() { // Fixture setup var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var expected = new DelegatingEqualityComparer(); var sut = new RecursionGuard(dummyBuilder, dummyHandler, expected); // Exercise system var actual = sut.Compose(new ISpecimenBuilder[0]); // Verify outcome var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); Assert.Equal(expected, rg.Comparer); // Teardown }
public void ComposeRetainsRecursionDepth() { // Arrange var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var dummyComparer = new DelegatingEqualityComparer(); int expected = 2; var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer, expected); // Act var actual = sut.Compose(new ISpecimenBuilder[0]); // Assert var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); Assert.Equal(expected, rg.RecursionDepth); }
public void ComposeSingleItemReturnsCorrectResult() { // Arrange var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var dummyComparer = new DelegatingEqualityComparer(); int dummyRecursionDepth = 2; var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer, dummyRecursionDepth); // Act var expected = new DelegatingSpecimenBuilder(); var actual = sut.Compose(new[] { expected }); // Assert var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); Assert.Equal(expected, rg.Builder); }
public void ComposeSingleItemReturnsCorrectResult() { // Fixture setup var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var dummyComparer = new DelegatingEqualityComparer(); int dummyRecursionDepth = 2; var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer, dummyRecursionDepth); // Exercise system var expected = new DelegatingSpecimenBuilder(); var actual = sut.Compose(new[] { expected }); // Verify outcome var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); Assert.Equal(expected, rg.Builder); // Teardown }
public void ComposeReturnsCorrectResult() { // Fixture setup var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var dummyComparer = new DelegatingEqualityComparer(); var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer); // Exercise system var expectedBuilders = new[] { new DelegatingSpecimenBuilder(), new DelegatingSpecimenBuilder(), new DelegatingSpecimenBuilder() }; var actual = sut.Compose(expectedBuilders); // Verify outcome var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); var composite = Assert.IsAssignableFrom <CompositeSpecimenBuilder>(rg.Builder); Assert.True(expectedBuilders.SequenceEqual(composite)); // Teardown }
public void ComposeReturnsCorrectResult() { // Arrange var dummyBuilder = new DelegatingSpecimenBuilder(); var dummyHandler = new DelegatingRecursionHandler(); var dummyComparer = new DelegatingEqualityComparer(); const int dummyRecursionDepth = 2; var sut = new RecursionGuard(dummyBuilder, dummyHandler, dummyComparer, dummyRecursionDepth); // Act var expectedBuilders = new[] { new DelegatingSpecimenBuilder(), new DelegatingSpecimenBuilder(), new DelegatingSpecimenBuilder() }; var actual = sut.Compose(expectedBuilders); // Assert var rg = Assert.IsAssignableFrom <RecursionGuard>(actual); var composite = Assert.IsAssignableFrom <CompositeSpecimenBuilder>(rg.Builder); Assert.True(expectedBuilders.SequenceEqual(composite)); }