blob: 131b72f0d24a7c359a1f305f9978e0337327118d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Patterns;
using Xunit;
namespace Microsoft.AspNetCore.Routing;
public class RouteEndpointBuilderTest
{
[Fact]
public void Build_AllValuesSet_EndpointCreated()
{
const int defaultOrder = 0;
var metadata = new object();
RequestDelegate requestDelegate = (d) => null;
var builder = new RouteEndpointBuilder(requestDelegate, RoutePatternFactory.Parse("/"), defaultOrder)
{
DisplayName = "Display name!",
Metadata = { metadata }
};
var endpoint = Assert.IsType<RouteEndpoint>(builder.Build());
Assert.Equal("Display name!", endpoint.DisplayName);
Assert.Equal(defaultOrder, endpoint.Order);
Assert.Equal(requestDelegate, endpoint.RequestDelegate);
Assert.Equal("/", endpoint.RoutePattern.RawText);
Assert.Equal(metadata, Assert.Single(endpoint.Metadata));
}
}
|