示例#1
0
        public void CustomizeShouldAddExactlyOneCustomizationToFixture(Mock <IFixture> fixtureMock,
                                                                       RecursionDepthCustomization sut)
        {
            // Arrange
            var behaviors = new List <ISpecimenBuilderTransformation>();

            fixtureMock.SetupGet(m => m.Behaviors)
            .Returns(behaviors);

            // Act
            sut.Customize(fixtureMock.Object);

            // Assert
            Assert.AreEqual(1, behaviors.Count);
        }
示例#2
0
        public void CustomizeShouldAddExpectedBehaviorToFixture(Mock <IFixture> fixtureMock,
                                                                RecursionDepthCustomization sut)
        {
            // Arrange
            var behaviors = new List <ISpecimenBuilderTransformation>();

            fixtureMock.SetupGet(m => m.Behaviors)
            .Returns(behaviors);

            // Act
            sut.Customize(fixtureMock.Object);

            // Assert
            var behavior = behaviors[0];

            Assert.AreEqual(typeof(OmitOnRecursionBehavior), behavior.GetType());
        }
示例#3
0
        public void CustomizeShouldRemoveBehaviorsOfTypeThrowingRecursionBehaviorFromFixture(Mock <IFixture> fixtureMock,
                                                                                             RecursionDepthCustomization sut)
        {
            // Arrange
            var behaviors = new List <ISpecimenBuilderTransformation>
            {
                new ThrowingRecursionBehavior()
            };

            fixtureMock.SetupGet(m => m.Behaviors)
            .Returns(behaviors);

            // Act
            sut.Customize(fixtureMock.Object);

            // Assert
            Assert.IsFalse(behaviors.OfType <ThrowingRecursionBehavior>().Any());
        }