simple commit
continuous-integration/drone/push Build is failing Details

customer_branche_TRO
Ismail TAHA JANAN 2 years ago
parent affb40b2b5
commit d549ec87b9

@ -31,20 +31,20 @@ namespace cat_cafe.Controllers.Tests
private readonly MapperConfiguration mapperConf = new(mapper => mapper.AddProfile(typeof(CatMapper))); private readonly MapperConfiguration mapperConf = new(mapper => mapper.AddProfile(typeof(CatMapper)));
private readonly DbContextOptions<CatCafeContext> options = new DbContextOptionsBuilder<CatCafeContext>() private readonly DbContextOptions<CatCafeDbContext> options = new DbContextOptionsBuilder<CatCafeDbContext>()
.UseInMemoryDatabase(databaseName: "CatCafeTests") .UseSqlite("Data Source=EFCatCafe.db").EnableSensitiveDataLogging()
.Options; .Options;
private readonly IMapper mapper; private readonly IMapper mapper;
private readonly CatCafeContext context; private readonly CatCafeDbContext context;
private readonly CatsController controller; private readonly CatsController controller;
public CatsControllerTest() public CatsControllerTest()
{ {
mapper = mapperConf.CreateMapper(); mapper = mapperConf.CreateMapper();
context = new CatCafeContext(options); context = new CatCafeDbContext(options);
controller = new CatsController(context, mapper, logger); controller = new CatsController(context, mapper, logger);
} }
@ -53,7 +53,7 @@ namespace cat_cafe.Controllers.Tests
public void BeforeEach() public void BeforeEach()
{ {
context.Database.EnsureCreated(); context.Database.EnsureCreated();
context.Cats.AddRange( context.cats.AddRange(
new Cat new Cat
{ {
Id = 1, Id = 1,

@ -15,10 +15,14 @@
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" /> <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" /> <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="coverlet.collector" Version="3.1.2" /> <PackageReference Include="coverlet.collector" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.12" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\cat_cafe\cat_cafe.csproj" /> <ProjectReference Include="..\cat_cafe\cat_cafe.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove="Microsoft.EntityFrameworkCore.InMemory" />
</ItemGroup>
</Project> </Project>

@ -149,3 +149,4 @@
2023-02-04 11:48:05.671 +01:00 [INF] program start 2023-02-04 11:48:05.671 +01:00 [INF] program start
2023-02-04 11:48:15.442 +01:00 [INF] GET => get All customers 2023-02-04 11:48:15.442 +01:00 [INF] GET => get All customers
2023-02-04 11:48:15.516 +01:00 [INF] GET => 200 System.Collections.Generic.List`1[cat_cafe.Entities.Customer] length[5] 2023-02-04 11:48:15.516 +01:00 [INF] GET => 200 System.Collections.Generic.List`1[cat_cafe.Entities.Customer] length[5]
2023-02-04 12:00:49.695 +01:00 [INF] program start

Loading…
Cancel
Save