Skip to content

Commit 31729d2

Browse files
committed
fix tests
1 parent 40a17f6 commit 31729d2

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ public void CreateThrowsInvalidOperationExceptionGivenUnnamedArgument()
479479
var unnamedParameter = Expression.Parameter(typeof(int));
480480
var lambda = Expression.Lambda(Expression.Block(), unnamedParameter);
481481
var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create((Action<int>)lambda.Compile(), new EmptyServiceProvdier()));
482-
Assert.Equal("A parameter does not have a name! Was it genererated? All parameters must be named.", ex.Message);
482+
Assert.Equal("A parameter does not have a name! Was it generated? All parameters must be named.", ex.Message);
483483
}
484484

485485
[Fact]

src/Http/Routing/test/UnitTests/Builder/MinimalActionEndpointRouteBuilderExtensionsTest.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,16 @@ void TestAction()
4242
var dataSource = Assert.Single(builder.DataSources);
4343
var endpoint = Assert.Single(dataSource.Endpoints);
4444

45-
var metadataArray = endpoint.Metadata.Where(m => m is not CompilerGeneratedAttribute).ToArray();
45+
var metadataArray = endpoint.Metadata.OfType<IHttpMethodMetadata>().ToArray();
46+
47+
static string GetMethod(IHttpMethodMetadata metadata) => Assert.Single(metadata.HttpMethods);
4648

4749
Assert.Equal(3, metadataArray.Length);
4850
Assert.Equal("ATTRIBUTE", GetMethod(metadataArray[0]));
4951
Assert.Equal("METHOD", GetMethod(metadataArray[1]));
5052
Assert.Equal("BUILDER", GetMethod(metadataArray[2]));
5153

5254
Assert.Equal("BUILDER", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()!.HttpMethods.Single());
53-
54-
string GetMethod(object metadata)
55-
{
56-
var httpMethodMetadata = Assert.IsAssignableFrom<IHttpMethodMetadata>(metadata);
57-
return Assert.Single(httpMethodMetadata.HttpMethods);
58-
}
5955
}
6056

6157
[Fact]

0 commit comments

Comments
 (0)