-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chore/package-update-230824
- Loading branch information
Showing
9 changed files
with
464 additions
and
13 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
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
49 changes: 49 additions & 0 deletions
49
src/tests/Fusion.Summary.Functions.Tests/Fusion.Summary.Functions.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,49 @@ | ||
<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="FluentAssertions" Version="6.12.1"/> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/> | ||
<PackageReference Include="xunit" Version="2.9.0"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Fusion.Summary.Functions\Fusion.Summary.Functions.csproj"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="nuget.config"/> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Update="nuget.config"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
</Project> |
110 changes: 110 additions & 0 deletions
110
...ts/Fusion.Summary.Functions.Tests/Notifications/Mock/NotificationReportApiResponseMock.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,110 @@ | ||
using Fusion.Resources.Functions.Common.ApiClients; | ||
|
||
namespace Fusion.Summary.Functions.Tests.Notifications.Mock; | ||
|
||
public abstract class NotificationReportApiResponseMock | ||
{ | ||
public static List<IResourcesApiClient.InternalPersonnelPerson> GetMockedInternalPersonnel( | ||
double personnelCount, | ||
double workload, | ||
double otherTasks, | ||
double vacationLeave, | ||
double absenceLeave) | ||
{ | ||
var personnel = new List<IResourcesApiClient.InternalPersonnelPerson>(); | ||
for (var i = 0; i < personnelCount; i++) | ||
{ | ||
personnel.Add(new IResourcesApiClient.InternalPersonnelPerson() | ||
{ | ||
EmploymentStatuses = new List<IResourcesApiClient.ApiPersonAbsence> | ||
{ | ||
new() | ||
{ | ||
Type = IResourcesApiClient.ApiAbsenceType.Vacation, | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AbsencePercentage = vacationLeave | ||
}, | ||
new() | ||
{ | ||
Type = IResourcesApiClient.ApiAbsenceType.OtherTasks, | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AbsencePercentage = otherTasks | ||
}, | ||
new() | ||
{ | ||
Type = IResourcesApiClient.ApiAbsenceType.Absence, | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AbsencePercentage = absenceLeave | ||
} | ||
}, | ||
PositionInstances = new List<IResourcesApiClient.PersonnelPosition> | ||
{ | ||
new() | ||
{ | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
Workload = workload | ||
} | ||
} | ||
} | ||
); | ||
; | ||
} | ||
|
||
return personnel; | ||
} | ||
|
||
public static List<IResourcesApiClient.InternalPersonnelPerson> GetMockedInternalPersonnelWithInstancesWithAndWithoutChanges(double personnelCount) | ||
{ | ||
var personnel = new List<IResourcesApiClient.InternalPersonnelPerson>(); | ||
for (var i = 0; i < personnelCount; i++) | ||
{ | ||
personnel.Add(new IResourcesApiClient.InternalPersonnelPerson() | ||
{ | ||
// Should return 4 instances for each person | ||
PositionInstances = new List<IResourcesApiClient.PersonnelPosition> | ||
{ | ||
new() | ||
{ | ||
// One active instance without any changes | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AllocationState = null, | ||
AllocationUpdated = null | ||
}, | ||
new() | ||
{ | ||
// One active instance that contains changes done within the last week | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AllocationState = "ChangeByTaskOwner", | ||
AllocationUpdated = DateTime.UtcNow | ||
}, | ||
new() | ||
{ | ||
// One active instance that contains changes done more than a week ago | ||
AppliesFrom = DateTime.UtcNow.AddDays(-1 - i), | ||
AppliesTo = DateTime.UtcNow.AddDays(1 + i * 10), | ||
AllocationState = "ChangeByTaskOwner", | ||
AllocationUpdated = DateTime.UtcNow.AddDays(-8) | ||
}, | ||
new() | ||
{ | ||
// One instance that will become active in more than 3 months that contains changes | ||
AppliesFrom = DateTime.UtcNow.AddMonths(4), | ||
AppliesTo = DateTime.UtcNow.AddMonths(4 + i), | ||
AllocationState = "ChangeByTaskOwner", | ||
AllocationUpdated = DateTime.UtcNow | ||
} | ||
} | ||
} | ||
); | ||
; | ||
} | ||
|
||
return personnel; | ||
} | ||
} |
Oops, something went wrong.