Skip to content

Commit

Permalink
Set the Environment Variable in CustomWebApplicationFacotry to "Test"
Browse files Browse the repository at this point in the history
(%release-note:

- Set the Environment Variable in CustomWebApplicationFacotry to "Test"
- Updated the nuget packages

%)
  • Loading branch information
Farshad DASHTI authored and Farshad DASHTI committed Nov 21, 2024
1 parent 04a0a6e commit 6d65d9f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
58 changes: 29 additions & 29 deletions src/DfE.CoreLibs.Testing/DfE.CoreLibs.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<Title>DfE.CoreLibs.Testing</Title>
<Description>Designed to enhance test automation, this library provides essential utilities and frameworks for unit and integration testing in .NET. It includes tools for mocking, assertions, and common test scenarios, helping developers write cleaner, more efficient tests that improve the overall quality and stability of their applications.</Description>
<Authors>DFE-Digital</Authors>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<Title>DfE.CoreLibs.Testing</Title>
<Description>Designed to enhance test automation, this library provides essential utilities and frameworks for unit and integration testing in .NET. It includes tools for mocking, assertions, and common test scenarios, helping developers write cleaner, more efficient tests that improve the overall quality and stability of their applications.</Description>
<Authors>DFE-Digital</Authors>
</PropertyGroup>


<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Azure.Identity" Version="1.12.1" />
<PackageReference Include="DfE.CoreLibs.Utilities" Version="1.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.8" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="DfE.CoreLibs.Utilities" Version="1.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.11" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="System.Formats.Asn1" Version="9.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
<None Update="readme.md">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class CustomWebApplicationDbContextFactory<TProgram> : WebApplicationFact

protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.UseEnvironment("Test");

builder.ConfigureServices(services =>
{
RemoveDbContextAndConnectionServices(services);
Expand All @@ -42,7 +44,6 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
services.AddSingleton<IEnumerable<Claim>>(sp => TestClaims ?? new());
});

builder.UseEnvironment("Development");
}

protected override void ConfigureClient(HttpClient client)
Expand Down

0 comments on commit 6d65d9f

Please sign in to comment.