Inheritance: Ploeh.AutoFixture.Kernel.RecursionGuard
 public void SutIsRecursionGuard()
 {
     // Fixture setup
     // Exercise system
     var sut = new ThrowingRecursionGuard(new DelegatingSpecimenBuilder());
     // Verify outcome
     Assert.IsAssignableFrom<RecursionGuard>(sut);
     // Teardown
 }
 public void BuilderIsCorrect()
 {
     // Fixture setup
     var expectedBuilder = new DelegatingSpecimenBuilder();
     var sut = new ThrowingRecursionGuard(expectedBuilder);
     // Exercise system
     var result = sut.Builder;
     // Verify outcome
     Assert.Equal(expectedBuilder, result);
     // Teardown
 }
        public void ThrowsAtRecursionPoint()
        {
            // Fixture setup
            var builder = new DelegatingSpecimenBuilder();
            builder.OnCreate = (r, c) => c.Resolve(r);
            var sut = new ThrowingRecursionGuard(builder);
            var container = new DelegatingSpecimenContext();
            container.OnResolve = r => sut.Create(r, container); // Provoke recursion

            // Exercise system
            Assert.Throws(typeof(ObjectCreationException), () => sut.Create(Guid.NewGuid(), container));
        }
 public void ComposeSingleItemReturnsCorrectResult()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     var sut = new ThrowingRecursionGuard(dummyBuilder);
     // Exercise system
     var expected = new DelegatingSpecimenBuilder();
     var actual = sut.Compose(new[] { expected });
     // Verify outcome
     var rg = Assert.IsAssignableFrom<ThrowingRecursionGuard>(actual);
     Assert.Equal(expected, rg.Builder);
     // Teardown
 }
 public void ComposeReturnsCorrectResult()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     var sut = new ThrowingRecursionGuard(dummyBuilder);
     // Exercise system
     var expectedBuilders = new[]
     {
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder(),
         new DelegatingSpecimenBuilder()
     };
     var actual = sut.Compose(expectedBuilders);
     // Verify outcome
     var rg = Assert.IsAssignableFrom<ThrowingRecursionGuard>(actual);
     var composite = Assert.IsAssignableFrom<CompositeSpecimenBuilder>(rg.Builder);
     Assert.True(expectedBuilders.SequenceEqual(composite));
     // Teardown
 }
 public void ComposeRetainsComparer()
 {
     // Fixture setup
     var dummyBuilder = new DelegatingSpecimenBuilder();
     var expected = new DelegatingEqualityComparer();
     var sut = new ThrowingRecursionGuard(dummyBuilder, expected);
     // Exercise system
     var actual = sut.Compose(new ISpecimenBuilder[0]);
     // Verify outcome
     var rg = Assert.IsAssignableFrom<ThrowingRecursionGuard>(actual);
     Assert.Equal(expected, rg.Comparer);
     // Teardown
 }