public void ComposesActionDescriptor_WithVoidResultConverter_WhenActionReturnsVoid(
            IFixture fixture, VoidActionFilterAttribute filter)
        {
            // Fixture setup
            fixture.Freeze<Mock<HttpActionDescriptor>>()
                .SetupGet(des => des.ReturnType)
                .Returns(null as Type);

            var context = fixture.Create<HttpActionContext>();
            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            context.ActionDescriptor.ResultConverter.Should().BeAssignableTo<JSendVoidResultConverter>();
        }
        public void DoesNotChangeDescriptor_WhenActionDoesNotReturnVoid(
            Type actionType, IFixture fixture, VoidActionFilterAttribute filter)
        {
            // Fixture setup
            fixture.Freeze<Mock<HttpActionDescriptor>>()
                .SetupGet(des => des.ReturnType)
                .Returns(actionType);

            var context = fixture.Create<HttpActionContext>();
            var initialDescriptor = context.ActionDescriptor;
            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            context.ActionDescriptor.Should().BeSameAs(initialDescriptor);
        }
Ejemplo n.º 3
0
        public void ComposesActionDescriptor_WithVoidResultConverter_WhenActionReturnsVoid(
            IFixture fixture, VoidActionFilterAttribute filter)
        {
            // Fixture setup
            fixture.Freeze <Mock <HttpActionDescriptor> >()
            .SetupGet(des => des.ReturnType)
            .Returns(null as Type);

            var context = fixture.Create <HttpActionContext>();

            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            context.ActionDescriptor.ResultConverter.Should().BeAssignableTo <JSendVoidResultConverter>();
        }
Ejemplo n.º 4
0
        public void DoesNotChangeDescriptor_WhenActionDoesNotReturnVoid(
            Type actionType, IFixture fixture, VoidActionFilterAttribute filter)
        {
            // Fixture setup
            fixture.Freeze <Mock <HttpActionDescriptor> >()
            .SetupGet(des => des.ReturnType)
            .Returns(actionType);

            var context           = fixture.Create <HttpActionContext>();
            var initialDescriptor = context.ActionDescriptor;

            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            context.ActionDescriptor.Should().BeSameAs(initialDescriptor);
        }
        public void WrapsActionDescriptor_WithDelegatingActionDescriptor_WhenActionReturnsVoid(
            IFixture fixture, VoidActionFilterAttribute filter)
        {
            // FIxture  setup
            var initialDescriptor = fixture.Freeze<HttpActionDescriptor>();

            Mock.Get(initialDescriptor)
                .SetupGet(des => des.ReturnType)
                .Returns(null as Type);

            var context = fixture.Create<HttpActionContext>();
            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            var descriptor = context.ActionDescriptor;

            descriptor.Should().BeOfType<DelegatingActionDescriptor>();
            descriptor.As<DelegatingActionDescriptor>()
                .InnerActionDescriptor.Should().Be(initialDescriptor);
        }
Ejemplo n.º 6
0
        public void WrapsActionDescriptor_WithDelegatingActionDescriptor_WhenActionReturnsVoid(
            IFixture fixture, VoidActionFilterAttribute filter)
        {
            // FIxture  setup
            var initialDescriptor = fixture.Freeze <HttpActionDescriptor>();

            Mock.Get(initialDescriptor)
            .SetupGet(des => des.ReturnType)
            .Returns(null as Type);

            var context = fixture.Create <HttpActionContext>();

            // Exercise system
            filter.OnActionExecuting(context);
            // Verify outcome
            var descriptor = context.ActionDescriptor;

            descriptor.Should().BeOfType <DelegatingActionDescriptor>();
            descriptor.As <DelegatingActionDescriptor>()
            .InnerActionDescriptor.Should().Be(initialDescriptor);
        }
 public void ThrowsWhenActionContextIsNull(VoidActionFilterAttribute filter)
 {
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() => filter.OnActionExecuting(null));
 }
Ejemplo n.º 8
0
 public void ThrowsWhenActionContextIsNull(VoidActionFilterAttribute filter)
 {
     // Exercise system and verify outcome
     Assert.Throws <ArgumentNullException>(() => filter.OnActionExecuting(null));
 }