-
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.
Added tests to the extension methods in the ScheduledTasks project.
- Loading branch information
Breno RdV
committed
Feb 11, 2024
1 parent
041447b
commit e4ec0cb
Showing
6 changed files
with
114 additions
and
3 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
46 changes: 46 additions & 0 deletions
46
Raccoon.Ninja.AzFn.ScheduledTasks.Tests/ExtensionMethods/ListExtensionsTests.cs
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,46 @@ | ||
using FluentAssertions; | ||
using Raccoon.Ninja.AzFn.ScheduledTasks.ExtensionMethods; | ||
using Raccoon.Ninja.TestHelpers; | ||
|
||
namespace Raccoon.Ninja.AzFn.ScheduledTasks.Tests.ExtensionMethods; | ||
|
||
public class ListExtensionsTests | ||
{ | ||
[Fact] | ||
public void ToGlucoseReadings_WhenCalled_ShouldReturnCorrectResult() | ||
{ | ||
// Arrange | ||
const int quantityDocuments = 2; | ||
var documents = Generators.NightScoutMongoDocumentMockList(quantityDocuments); | ||
|
||
var previousReading = Generators.GlucoseReadingMockSingle(); | ||
|
||
// Act | ||
var result = documents.ToGlucoseReadings(previousReading).ToList(); | ||
|
||
// Assert | ||
result.Should().NotBeNull(); | ||
result.Should().HaveCount(quantityDocuments); | ||
result[0].Value.Should().Be(documents[0].Value); | ||
result[1].Value.Should().Be(documents[1].Value); | ||
} | ||
|
||
[Fact] | ||
public void ToGlucoseReadings_WhenCalledWillIgnoreNulls_ShouldReturnCorrectResult() | ||
{ | ||
// Arrange | ||
const int quantityDocuments = 2; | ||
var documents = Generators.NightScoutMongoDocumentMockList(quantityDocuments); | ||
documents.Add(null); | ||
var previousReading = Generators.GlucoseReadingMockSingle(); | ||
|
||
// Act | ||
var result = documents.ToGlucoseReadings(previousReading).ToList(); | ||
|
||
// Assert | ||
result.Should().NotBeNull(); | ||
result.Should().HaveCount(quantityDocuments); | ||
result[0].Value.Should().Be(documents[0].Value); | ||
result[1].Value.Should().Be(documents[1].Value); | ||
} | ||
} |
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 @@ | ||
global using Xunit; |
31 changes: 31 additions & 0 deletions
31
Raccoon.Ninja.AzFn.ScheduledTasks.Tests/Raccoon.Ninja.AzFn.ScheduledTasks.Tests.csproj
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,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageReference Include="xunit" Version="2.6.6" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Raccoon.Ninja.AzFn.ScheduledTasks\Raccoon.Ninja.AzFn.ScheduledTasks.csproj" /> | ||
<ProjectReference Include="..\Raccoon.Ninja.TestHelpers\Raccoon.Ninja.TestHelpers.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
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