| @@ -15,3 +15,6 @@ | |||
| /Diligent.WebAPI.Contracts/bin/Debug/net6.0 | |||
| /Diligent.WebAPI.Contracts/obj/Debug/net6.0 | |||
| /Diligent.WebAPI.Contracts/obj | |||
| /Diligent.WebAPI.Tests/bin/Debug/net6.0 | |||
| /Diligent.WebAPI.Tests/obj/Debug/net6.0 | |||
| /Diligent.WebAPI.Tests/obj | |||
| @@ -0,0 +1,33 @@ | |||
| using NSubstitute; | |||
| namespace Diligent.WebAPI.Tests.Controllers | |||
| { | |||
| public class InsurersControllerTests | |||
| { | |||
| private readonly IInsurersService iNsurersService = Substitute.For<IInsurersService>(); | |||
| private readonly InsurersController insurersController; | |||
| public InsurersControllerTests() | |||
| { | |||
| insurersController = new InsurersController(iNsurersService); | |||
| } | |||
| [Fact] | |||
| public async Task GetById_ShouldReturn200OK_WhenInsurerExists() | |||
| { | |||
| // Arrange | |||
| int insurerId = 1; | |||
| string insurerName = "John Doe"; | |||
| var insurer = new InsurerViewDto | |||
| { | |||
| Id = insurerId, | |||
| FirstName = insurerName | |||
| }; | |||
| // Act | |||
| var result = await insurersController.GetInsurer(insurerId); | |||
| // Assert | |||
| (result as OkObjectResult).StatusCode.Should().Be(200); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,33 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| <PropertyGroup> | |||
| <TargetFramework>net6.0</TargetFramework> | |||
| <ImplicitUsings>enable</ImplicitUsings> | |||
| <Nullable>enable</Nullable> | |||
| <IsPackable>false</IsPackable> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="FluentAssertions" Version="6.8.0" /> | |||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | |||
| <PackageReference Include="NSubstitute" Version="4.4.0" /> | |||
| <PackageReference Include="xunit" Version="2.4.1" /> | |||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | |||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||
| <PrivateAssets>all</PrivateAssets> | |||
| </PackageReference> | |||
| <PackageReference Include="coverlet.collector" Version="3.1.2"> | |||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||
| <PrivateAssets>all</PrivateAssets> | |||
| </PackageReference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\Diligent.WebAPI.Business\Diligent.WebAPI.Business.csproj" /> | |||
| <ProjectReference Include="..\Diligent.WebAPI.Contracts\Diligent.WebAPI.Contracts.csproj" /> | |||
| <ProjectReference Include="..\Diligent.WebAPI.Data\Diligent.WebAPI.Data.csproj" /> | |||
| <ProjectReference Include="..\Diligent.WebAPI.Host\Diligent.WebAPI.Host.csproj" /> | |||
| </ItemGroup> | |||
| </Project> | |||
| @@ -0,0 +1,7 @@ | |||
| global using Xunit; | |||
| global using Diligent.WebAPI.Business.Services.Interfaces; | |||
| global using Diligent.WebAPI.Contracts.DTOs.Insurer; | |||
| global using Diligent.WebAPI.Host.Controllers.V1; | |||
| global using FluentAssertions; | |||
| global using Microsoft.AspNetCore.Mvc; | |||
| global using NSubstitute; | |||
| @@ -14,7 +14,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution | |||
| .editorconfig = .editorconfig | |||
| EndProjectSection | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diligent.WebAPI.Contracts", "Diligent.WebAPI.Contracts\Diligent.WebAPI.Contracts.csproj", "{A0B92A73-4167-4B87-99FC-C268265BF9BA}" | |||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Diligent.WebAPI.Contracts", "Diligent.WebAPI.Contracts\Diligent.WebAPI.Contracts.csproj", "{A0B92A73-4167-4B87-99FC-C268265BF9BA}" | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diligent.WebAPI.Tests", "Diligent.WebAPI.Tests\Diligent.WebAPI.Tests.csproj", "{12B60EC7-349B-4B54-B27C-E1F3551E2FDB}" | |||
| EndProject | |||
| Global | |||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
| @@ -38,6 +40,10 @@ Global | |||
| {A0B92A73-4167-4B87-99FC-C268265BF9BA}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {A0B92A73-4167-4B87-99FC-C268265BF9BA}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {A0B92A73-4167-4B87-99FC-C268265BF9BA}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| {12B60EC7-349B-4B54-B27C-E1F3551E2FDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {12B60EC7-349B-4B54-B27C-E1F3551E2FDB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {12B60EC7-349B-4B54-B27C-E1F3551E2FDB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {12B60EC7-349B-4B54-B27C-E1F3551E2FDB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| EndGlobalSection | |||
| GlobalSection(SolutionProperties) = preSolution | |||
| HideSolutionNode = FALSE | |||