Addet integration test
This commit is contained in:
32
PointOfSale/IntegrationTests/IntegrationTests.csproj
Normal file
32
PointOfSale/IntegrationTests/IntegrationTests.csproj
Normal file
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Pos.Ui\Database\Database.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
29
PointOfSale/IntegrationTests/PosDbContextTests.cs
Normal file
29
PointOfSale/IntegrationTests/PosDbContextTests.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Database;
|
||||
using Database.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace IntegrationTests;
|
||||
|
||||
public class PosDbContextTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public PosDbContextTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmployeeRepository_ShouldReturnEmployees()
|
||||
{
|
||||
using var repository = new EmployeeRepository();
|
||||
|
||||
var employees = repository.GetAll();
|
||||
|
||||
_output.WriteLine(
|
||||
$"Antal medarbejdere hentet: {employees.Count}");
|
||||
|
||||
Assert.NotEmpty(employees);
|
||||
}
|
||||
}
|
||||
3
PointOfSale/IntegrationTests/appsettings.json
Normal file
3
PointOfSale/IntegrationTests/appsettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"SqlServer": "Server=(localdb)\\MSSQLLocalDB;Database=pointofsale;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||
}
|
||||
Reference in New Issue
Block a user