Skip to content

Commit

Permalink
.NET 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Olgasn committed Aug 26, 2024
1 parent 29ecbb8 commit 375c815
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 41 deletions.
6 changes: 3 additions & 3 deletions FuelStation.Persistence/DbInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static void Initialize(FuelStationDbContext context)
Random randObj = new(1);

//Заполнение таблицы емкостей
string[] tank_voc = { "Цистерна_", "Ведро_", "Бак_", "Фляга_", "Цистерна_" };//словарь названий емкостей
string[] material_voc = { "Сталь", "Платина", "Алюминий", "ПЭТ", "Чугун", "Алюминий", "Сталь" };//словарь названий видов топлива
string[] tank_voc = ["Цистерна_", "Ведро_", "Бак_", "Фляга_", "Цистерна_"];//словарь названий емкостей
string[] material_voc = ["Сталь", "Платина", "Алюминий", "ПЭТ", "Чугун", "Алюминий", "Сталь"];//словарь названий видов топлива
int count_tank_voc = tank_voc.GetLength(0);
int count_material_voc = material_voc.GetLength(0);
for (int tankId = 1; tankId <= tanks_number; tankId++)
Expand All @@ -46,7 +46,7 @@ public static void Initialize(FuelStationDbContext context)
context.SaveChanges();

//Заполнение таблицы видов топлива
string[] fuel_voc = { "Нефть_", "Бензин_", "Керосин_", "Мазут_", "Спирт_" };
string[] fuel_voc = ["Нефть_", "Бензин_", "Керосин_", "Мазут_", "Спирт_"];
int count_fuel_voc = fuel_voc.GetLength(0);
for (int fuelId = 1; fuelId <= fuels_number; fuelId++)
{
Expand Down
2 changes: 1 addition & 1 deletion FuelStation.Persistence/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class DependencyInjection
public static IServiceCollection AddPersistence(this IServiceCollection
services, IConfiguration configuration)
{
string connectionString = configuration["DbConnection"];
string connectionString = configuration["DbConnection"] ?? "";
services.AddDbContext<FuelStationDbContext>(options =>
{
options.UseSqlite(connectionString);
Expand Down
4 changes: 2 additions & 2 deletions FuelStation.Persistence/FuelStation.Persistence.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions FuelStation.Persistence/FuelStationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@

namespace FuelStation.Persistence
{
public class FuelStationDbContext : DbContext, IFuelStationDbContext
public class FuelStationDbContext(DbContextOptions<FuelStationDbContext> options) : DbContext(options), IFuelStationDbContext
{
public DbSet<Fuel> Fuels { get; set; } = null!;
public DbSet<Tank> Tanks { get; set; } = null!;
public DbSet<Operation> Operations { get; set; } = null!;
public FuelStationDbContext(DbContextOptions<FuelStationDbContext> options) : base(options)
{


}

protected override void OnModelCreating(ModelBuilder builder)
{
Expand Down
6 changes: 3 additions & 3 deletions FuelStation.Tests/Common/FuelStationContextFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static FuelStationDbContext Create()
Random randObj = new(1);

//Заполнение таблицы емкостей
string[] tankDictionary = { "Цистерна_", "Ведро_", "Бак_", "Фляга_", "Цистерна_" };//словарь названий емкостей
string[] materialDictionary = { "Сталь", "Платина", "Алюминий", "ПЭТ", "Чугун", "Алюминий", "Сталь" };//словарь названий видов топлива
string[] tankDictionary = ["Цистерна_", "Ведро_", "Бак_", "Фляга_", "Цистерна_"];//словарь названий емкостей
string[] materialDictionary = ["Сталь", "Платина", "Алюминий", "ПЭТ", "Чугун", "Алюминий", "Сталь"];//словарь названий видов топлива
int count_tankDictionary = tankDictionary.GetLength(0);
int count_materialDictionary = materialDictionary.GetLength(0);
for (int tankId = 1; tankId <= tanksNumber - 1; tankId++)
Expand Down Expand Up @@ -70,7 +70,7 @@ public static FuelStationDbContext Create()
context.SaveChanges();

//Заполнение таблицы видов топлива
string[] fuelDictionary = { "Нефть_", "Бензин_", "Керосин_", "Мазут_", "Спирт_" };
string[] fuelDictionary = ["Нефть_", "Бензин_", "Керосин_", "Мазут_", "Спирт_"];
int count_fuelDictionary = fuelDictionary.GetLength(0);
for (int fuelId = 1; fuelId <= fuelsNumber - 1; fuelId++)
{
Expand Down
12 changes: 6 additions & 6 deletions FuelStation.Tests/FuelStation.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
12 changes: 3 additions & 9 deletions FuelStation.Tests/Tanks/Queries/GetTankListQueryHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
namespace FuelStation.Tests.Tanks.Queries
{
[Collection("QueryCollection")]
public class GetTankListQueryHandlerTests
public class GetTankListQueryHandlerTests(QueryTestFixture fixture)
{
private readonly FuelStationDbContext Context;
private readonly IMapper Mapper;

public GetTankListQueryHandlerTests(QueryTestFixture fixture)
{
Context = fixture.Context;
Mapper = fixture.Mapper;
}
private readonly FuelStationDbContext Context = fixture.Context;
private readonly IMapper Mapper = fixture.Mapper;

[Fact]
public async Task GetTankListQueryHandler_Success()
Expand Down
8 changes: 4 additions & 4 deletions FuelStation.Web/FuelStation.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -14,9 +14,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions FuelStationApplication/FuelStation.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.7.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.7.1" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentValidation" Version="11.9.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
<PackageReference Include="MediatR" Version="12.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion FuelStationDomain/FuelStation.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down

0 comments on commit 375c815

Please sign in to comment.