Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="Backport.System.Threading.Lock" Version="3.1.4" />
<PackageVersion Include="Codebelt.Extensions.Xunit" Version="9.0.1" />
<PackageVersion Include="Codebelt.Extensions.Xunit.Hosting" Version="9.0.1" />
<PackageVersion Include="Codebelt.Extensions.Xunit.Hosting.AspNetCore" Version="9.0.1" />
<PackageVersion Include="Codebelt.Extensions.Xunit" Version="9.1.2" />
<PackageVersion Include="Codebelt.Extensions.Xunit.Hosting" Version="9.1.2" />
<PackageVersion Include="Codebelt.Extensions.Xunit.Hosting.AspNetCore" Version="9.1.2" />
<PackageVersion Include="Codebelt.Extensions.YamlDotNet" Version="9.0.0" />
<PackageVersion Include="Meziantou.Xunit.ParallelTestFramework" Version="2.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public async Task HandleAuthenticateAsync_ShouldReturnContent()
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
},
hostFixture: null))
{
var client = webApp.Host.GetTestClient();
var bb = new BasicAuthorizationHeaderBuilder()
Expand Down Expand Up @@ -92,7 +93,7 @@ public async Task HandleAuthenticateAsync_ShouldReturn401WithUnauthorizedMessage
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<BasicAuthenticationOptions>>().Get(BasicAuthorizationHeader.Scheme);
var client = webApp.Host.GetTestClient();
Expand Down Expand Up @@ -140,7 +141,7 @@ public async Task HandleAuthenticateAsync_EnsureAnonymousIsWorking()
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = webApp.Host.GetTestClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task InvokeAsync_ShouldThrowUnauthorizedException_InvalidCredential
}, app =>
{
app.UseBasicAuthentication();
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<BasicAuthenticationOptions>>();
Expand Down Expand Up @@ -78,7 +78,7 @@ public async Task InvokeAsync_ShouldCaptureUnauthorizedException_InvalidCredenti
{
app.UseFaultDescriptorExceptionHandler();
app.UseBasicAuthentication();
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<BasicAuthenticationOptions>>();
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task InvokeAsync_ShouldAuthenticateWhenApplyingAuthorizationHeader(
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<BasicAuthenticationOptions>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task HandleAuthenticateAsync_ShouldReturnContent_WithQopAuthenticat
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{

var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<DigestAuthenticationOptions>>().Get(DigestAuthorizationHeader.Scheme);
Expand Down Expand Up @@ -135,7 +135,7 @@ public async Task HandleAuthenticateAsync_ShouldReturnContent_QopAuthenticationI
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{

var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<DigestAuthenticationOptions>>().Get(DigestAuthorizationHeader.Scheme);
Expand Down Expand Up @@ -214,7 +214,7 @@ public async Task HandleAuthenticateAsync_ShouldReturnContent_WithServerSideHa1S
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{

var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<DigestAuthenticationOptions>>().Get(DigestAuthorizationHeader.Scheme);
Expand Down Expand Up @@ -289,7 +289,7 @@ public async Task HandleAuthenticateAsync_ShouldReturn401WithUnauthorizedMessage
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<DigestAuthenticationOptions>>().Get(DigestAuthorizationHeader.Scheme);
var client = webApp.Host.GetTestClient();
Expand Down Expand Up @@ -331,7 +331,7 @@ public async Task HandleAuthenticateAsync_EnsureAnonymousIsWorking()
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = webApp.Host.GetTestClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task InvokeAsync_ShouldNotBeAuthenticated()
{
app.UseExceptionMiddleware();
app.UseDigestAccessAuthentication();
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<DigestAuthenticationOptions>>();
Expand Down Expand Up @@ -101,7 +101,7 @@ public async Task InvokeAsync_ShouldAuthenticateWhenApplyingAuthorizationHeader(
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<DigestAuthenticationOptions>>();
Expand Down Expand Up @@ -178,7 +178,7 @@ public async Task InvokeAsync_ShouldAuthenticateWhenApplyingAuthorizationHeaderN
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<DigestAuthenticationOptions>>();
Expand Down Expand Up @@ -253,7 +253,7 @@ public async Task InvokeAsync_ShouldAuthenticateWhenApplyingAuthorizationHeaderW
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<DigestAuthenticationOptions>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task HandleAuthenticateAsync_ShouldReturnContent()
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = webApp.Host.GetTestClient();

Expand Down Expand Up @@ -126,7 +126,7 @@ public async Task HandleAuthenticateAsync_ShouldReturn401WithUnauthorizedMessage
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var options = webApp.ServiceProvider.GetRequiredScopedService<IOptionsSnapshot<HmacAuthenticationOptions>>().Get(AuthenticationScheme);
var client = webApp.Host.GetTestClient();
Expand Down Expand Up @@ -183,7 +183,7 @@ public async Task HandleAuthenticateAsync_EnsureAnonymousIsWorking()
app.UseAuthorization();

app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = webApp.Host.GetTestClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public async Task InvokeAsync_ShouldAuthenticateWhenApplyingAuthorizationHeader(
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
}))
}, hostFixture: null))
{
var context = middleware.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var options = middleware.ServiceProvider.GetRequiredService<IOptions<HmacAuthenticationOptions>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public HmacAuthorizationHeaderBuilderTest(ITestOutputHelper output) : base(outpu
[Fact]
public void Build_ShouldGenerateValidAuthorizationHeader()
{
using var mw = WebHostTestFactory.Create();
using var mw = WebHostTestFactory.Create(hostFixture: null);
var context = mw.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;

var timestamp = DateTime.Parse("2022-07-10T12:50:42.2737531Z", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task UseFaultDescriptorExceptionHandler_ShouldCaptureException_Rend
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
return client.GetAsync("/");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();

Expand Down Expand Up @@ -342,7 +342,7 @@ public async Task UseFaultDescriptorExceptionHandler_ShouldCaptureException_Rend
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
return client.GetAsync("/");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();

Expand Down Expand Up @@ -600,7 +600,7 @@ public async Task UseFaultDescriptorExceptionHandler_ShouldCaptureException_Rend
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml"));
return client.GetAsync("/");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();

Expand Down Expand Up @@ -690,7 +690,7 @@ public async Task UseFaultDescriptorExceptionHandler_ShouldCaptureException_Rend
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml"));
return client.GetAsync("/");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task OnException_ShouldCaptureException_RenderAsProblemDetails_Usin
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
return client.GetAsync("/statuscodes/XXX/serverError");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();
TestOutput.WriteLine(body);
Expand Down Expand Up @@ -311,7 +311,7 @@ public async Task OnException_ShouldCaptureException_RenderAsDefault_UsingJson(F
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
return client.GetAsync("/statuscodes/XXX/serverError");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();
TestOutput.WriteLine(body);
Expand Down Expand Up @@ -584,7 +584,7 @@ public async Task OnException_ShouldCaptureException_RenderAsProblemDetails_Usin
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml"));
return client.GetAsync("/statuscodes/XXX/serverError");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();
TestOutput.WriteLine(body);
Expand Down Expand Up @@ -831,7 +831,7 @@ public async Task OnException_ShouldCaptureException_RenderAsDefault_UsingXml(Fa
{
client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/xml"));
return client.GetAsync("/statuscodes/XXX/serverError");
});
}, hostFixture: null);

var body = await response.Content.ReadAsStringAsync();
TestOutput.WriteLine(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task GetEtag_ShouldReturnOkWithEtagAndSubsequentlyNotModified(strin
{
app.UseRouting();
app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = filter.Host.GetTestClient();
var result = await client.GetAsync(relativeEndpoint);
Expand Down Expand Up @@ -64,7 +64,7 @@ public async Task GetLastModified_ShouldReturnOkWithLastModifiedAndSubsequentlyN
{
app.UseRouting();
app.UseEndpoints(routes => { routes.MapControllers(); });
}))
}, hostFixture: null))
{
var client = filter.Host.GetTestClient();
var result = await client.GetAsync("/fake/getCacheByLastModified");
Expand Down
Loading
Loading