Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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
        }
Ejemplo n.º 5
0
        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
        }
Ejemplo n.º 6
0
        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));
        }