コード例 #1
0
        public void MapEndpoint_TypedPattern_BuildsEndpoint()
        {
            // Arrange
            var             builder         = new DefaultEndpointDataSourceBuilder();
            RequestDelegate requestDelegate = (d) => null;

            // Act
            var endpointBuilder = builder.MapEndpoint(requestDelegate, RoutePatternFactory.Parse("/"), "Display name!");

            // Assert
            Assert.Equal(endpointBuilder, Assert.Single(builder.Endpoints));
            Assert.Equal(requestDelegate, endpointBuilder.RequestDelegate);
            Assert.Equal("Display name!", endpointBuilder.DisplayName);
            Assert.Equal("/", endpointBuilder.RoutePattern.RawText);
        }
コード例 #2
0
        public void MapEndpoint_StringPattern_BuildsEndpoint()
        {
            // Arrange
            var builder = new DefaultEndpointDataSourceBuilder();
            Func <RequestDelegate, RequestDelegate> invoker = (d) => null;

            // Act
            var endpointBuilder = builder.MapEndpoint(invoker, "/", "Display name!");

            // Assert
            Assert.Equal(endpointBuilder, Assert.Single(builder.Endpoints));
            Assert.Equal(invoker, endpointBuilder.Invoker);
            Assert.Equal("Display name!", endpointBuilder.DisplayName);
            Assert.Equal("/", endpointBuilder.RoutePattern.RawText);
        }
コード例 #3
0
        public void MapEndpoint_StringPatternAndMetadata_BuildsEndpoint()
        {
            // Arrange
            var             metadata        = new object();
            var             builder         = new DefaultEndpointDataSourceBuilder();
            RequestDelegate requestDelegate = (d) => null;

            // Act
            var endpointBuilder = builder.MapEndpoint(requestDelegate, "/", "Display name!", new[] { metadata });

            // Assert
            Assert.Equal(endpointBuilder, Assert.Single(builder.Endpoints));
            Assert.Equal(requestDelegate, endpointBuilder.RequestDelegate);
            Assert.Equal("Display name!", endpointBuilder.DisplayName);
            Assert.Equal("/", endpointBuilder.RoutePattern.RawText);
            Assert.Equal(metadata, Assert.Single(endpointBuilder.Metadata));
        }
コード例 #4
0
        public void MapEndpoint_TypedPatternAndMetadata_BuildsEndpoint()
        {
            // Arrange
            var metadata = new object();
            var builder  = new DefaultEndpointDataSourceBuilder();
            Func <RequestDelegate, RequestDelegate> invoker = (d) => null;

            // Act
            var endpointBuilder = builder.MapEndpoint(invoker, RoutePatternFactory.Parse("/"), "Display name!", new[] { metadata });

            // Assert
            Assert.Equal(endpointBuilder, Assert.Single(builder.Endpoints));
            Assert.Equal(invoker, endpointBuilder.Invoker);
            Assert.Equal("Display name!", endpointBuilder.DisplayName);
            Assert.Equal("/", endpointBuilder.RoutePattern.RawText);
            Assert.Equal(metadata, Assert.Single(endpointBuilder.Metadata));
        }