예제 #1
0
        public async Task EndpointBuilder_should_fail_if_route_is_null()
        {
            // arrange
            var context = new Mock <IHttpContextAccessor>();
            var builder = new EndpointBuilder(context.Object);

            context.Setup(c => c.HttpContext)
            .Returns(new DefaultHttpContext());

            // act
            // assert
            await Assert.ThrowsAsync <ArgumentNullException>(() => builder.CreateFromRoute(null));
        }
예제 #2
0
        public async Task EndpointBuilder_should_return_endpoint()
        {
            // arrange
            var context = new Mock <IHttpContextAccessor>();
            var builder = new EndpointBuilder(context.Object);

            context.Setup(c => c.HttpContext)
            .Returns(new DefaultHttpContext());

            // act
            var endpoint = await builder.CreateFromRoute(new RouteInformation());

            // assert
            Assert.IsType <Endpoint>(endpoint);
        }