-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mock LiceCount weekly Post to Mattilsynet
- Loading branch information
Showing
11 changed files
with
103 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="xunit" Version="2.5.3"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AquaApi\AquaApi.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AquaApi.Application; | ||
|
||
namespace AquaApi.Tests; | ||
|
||
public class MattilsynetServiceTests | ||
{ | ||
[Fact] | ||
public async Task PostLiceCount_ShouldReturnSuccess() | ||
{ | ||
// Act | ||
var client = new MockMattilsynetClient(); | ||
var service = new MattilsynetService(client); | ||
var result = await service.PostLiceCount(); | ||
|
||
// Assert | ||
Assert.True(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AquaApi.Domain; | ||
|
||
namespace AquaApi.Application; | ||
|
||
public class MattilsynetService(IMattilsynetClient client) | ||
{ | ||
public async Task<bool> PostLiceCount() | ||
{ | ||
var liceCount = new LiceCount | ||
{ | ||
VoksneHunnlus = 11, | ||
BevegeligeLus = 4, | ||
FastsittendeLus = 1, | ||
}; | ||
var response = await client.PostLiceCount(liceCount); | ||
return response.IsSuccessStatusCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace AquaApi.Domain; | ||
|
||
public class LiceCount | ||
{ | ||
public double VoksneHunnlus { get; set; } | ||
public double BevegeligeLus { get; set; } | ||
public double FastsittendeLus { get; set; } | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using AquaApi.Domain; | ||
|
||
namespace AquaApi; | ||
|
||
public interface IMattilsynetClient | ||
{ | ||
Task<HttpResponseMessage> PostLiceCount(LiceCount liceCount); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Net; | ||
using AquaApi.Domain; | ||
|
||
namespace AquaApi; | ||
|
||
public class MockMattilsynetClient : IMattilsynetClient | ||
{ | ||
public async Task<HttpResponseMessage> PostLiceCount(LiceCount liceCount) | ||
{ | ||
await Task.Delay(200); | ||
return new HttpResponseMessage(HttpStatusCode.Created); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters