public void TransformNullBuilderThrows() { // Arrange var sut = new ThrowingRecursionBehavior(); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.Transform(null)); }
public void SutIsSpecimenBuilderTransformation() { // Arrange // Act var sut = new ThrowingRecursionBehavior(); // Assert Assert.IsAssignableFrom <ISpecimenBuilderTransformation>(sut); }
public void TransformNullBuilderThrows() { // Fixture setup var sut = new ThrowingRecursionBehavior(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Transform(null)); // Teardown }
public void SutIsSpecimenBuilderTransformation() { // Fixture setup // Exercise system var sut = new ThrowingRecursionBehavior(); // Verify outcome Assert.IsAssignableFrom <ISpecimenBuilderTransformation>(sut); // Teardown }
public void TransformResultCorrectlyDecoratesInput() { // Arrange var sut = new ThrowingRecursionBehavior(); var expectedBuilder = new DelegatingSpecimenBuilder(); // Act var result = sut.Transform(expectedBuilder); // Assert var guard = Assert.IsAssignableFrom <RecursionGuard>(result); Assert.Equal(expectedBuilder, guard.Builder); }
public void TransformReturnsCorrectResult() { // Arrange var sut = new ThrowingRecursionBehavior(); // Act var dummyBuilder = new DelegatingSpecimenBuilder(); var result = sut.Transform(dummyBuilder); // Assert var rg = Assert.IsAssignableFrom <RecursionGuard>(result); Assert.IsAssignableFrom <ThrowingRecursionHandler>(rg.RecursionHandler); }
public void TransformReturnsCorrectResult() { // Fixture setup var sut = new ThrowingRecursionBehavior(); // Exercise system var dummyBuilder = new DelegatingSpecimenBuilder(); var result = sut.Transform(dummyBuilder); // Verify outcome Assert.IsAssignableFrom <ThrowingRecursionGuard>(result); // Teardown }
public void TransformResultCorrectlyDecoratesInput() { // Fixture setup var sut = new ThrowingRecursionBehavior(); var expectedBuilder = new DelegatingSpecimenBuilder(); // Exercise system var result = sut.Transform(expectedBuilder); // Verify outcome var guard = Assert.IsAssignableFrom <RecursionGuard>(result); Assert.Equal(expectedBuilder, guard.Builder); // Teardown }
/// <summary> /// Added the global customizations to the <paramref name="fixture"/>. /// </summary> /// <param name="fixture">The test fixture.</param> /// <exception cref="ArgumentNullException">The <paramref name="fixture"/> parameter is /// <see langword="null"/>.</exception> private static void GlobalCustomizations(IFixture fixture) { if (fixture == null) { throw new ArgumentNullException(nameof(fixture)); } // Don't need to create complex graphs, just need objects. ThrowingRecursionBehavior throwingRecursionBehavior = fixture.Behaviors.OfType <ThrowingRecursionBehavior>().SingleOrDefault(); if (throwingRecursionBehavior != null) { fixture.Behaviors.Remove(throwingRecursionBehavior); fixture.Behaviors.Add(new OmitOnRecursionBehavior()); } fixture.OmitAutoProperties = true; }
internal void AddGlobalCustomizationsIsIdempotent( IFixture fixture) { // Arrange ThrowingRecursionBehavior throwingRecursionBehavior = fixture.Behaviors.OfType <ThrowingRecursionBehavior>().SingleOrDefault(); if (throwingRecursionBehavior != null) { fixture.Behaviors.Remove(throwingRecursionBehavior); fixture.Behaviors.Add(new OmitOnRecursionBehavior()); } Assert.False(fixture.OmitAutoProperties); // Act var sut = new SpecimenProvider(fixture); // Assert Assert.Same(fixture, sut.Builder); Assert.Empty(fixture.Behaviors.OfType <ThrowingRecursionBehavior>()); Assert.Single(fixture.Behaviors.OfType <OmitOnRecursionBehavior>()); Assert.True(fixture.OmitAutoProperties); }