Skip to content

Commit

Permalink
Add round rnaking tests project
Browse files Browse the repository at this point in the history
  • Loading branch information
araszka committed Oct 6, 2024
1 parent d52cba8 commit 80fb3d6
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 2 deletions.
7 changes: 7 additions & 0 deletions EvoSC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpectatorCamModeModule.Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoundRankingModule", "src\Modules\RoundRankingModule\RoundRankingModule.csproj", "{41FD20E7-5064-425F-B110-CEBD53F80ECA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoundRankingModule.Tests", "tests\Modules\RoundRankingModule.Tests\RoundRankingModule.Tests.csproj", "{2623A6E2-125F-49B5-B8E1-5883B6E36C1A}"
EndProject



Expand Down Expand Up @@ -453,6 +455,10 @@ Global
{41FD20E7-5064-425F-B110-CEBD53F80ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41FD20E7-5064-425F-B110-CEBD53F80ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41FD20E7-5064-425F-B110-CEBD53F80ECA}.Release|Any CPU.Build.0 = Release|Any CPU
{2623A6E2-125F-49B5-B8E1-5883B6E36C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2623A6E2-125F-49B5-B8E1-5883B6E36C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2623A6E2-125F-49B5-B8E1-5883B6E36C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2623A6E2-125F-49B5-B8E1-5883B6E36C1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -524,5 +530,6 @@ Global
{E9806703-6E24-4F05-A728-A04F7EB31749} = {DC47658A-F421-4BA4-B617-090A7DFB3900}
{09A88256-8008-4085-A8E6-CA6DEFAC63E3} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
{41FD20E7-5064-425F-B110-CEBD53F80ECA} = {DC47658A-F421-4BA4-B617-090A7DFB3900}
{2623A6E2-125F-49B5-B8E1-5883B6E36C1A} = {6D75D6A2-6ECD-4DE4-96C5-CAD7D134407A}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ public class CheckpointsRepository : Dictionary<string, CheckpointData>
public List<CheckpointData> GetSortedData()
{
return this.Values
.OrderBy(cpData => cpData.IsDNF)
.ThenByDescending(cpData => cpData.CheckpointId)
.OrderByDescending(cpData => cpData.CheckpointId)
.ThenBy(cpData => cpData.Time.TotalMilliseconds)
.ToList();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using EvoSC.Common.Interfaces.Controllers;
using EvoSC.Common.Remote.EventArgsModels;
using EvoSC.Modules.Official.RoundRankingModule.Controllers;
using EvoSC.Modules.Official.RoundRankingModule.Interfaces;
using EvoSC.Testing.Controllers;
using Moq;
using Xunit;

namespace EvoSC.Modules.Official.RoundRankingModule.Tests.Controllers;

public class RoundRankingEventControllerTests : ControllerMock<RoundRankingEventController, IEventControllerContext>
{
private Mock<IRoundRankingService> _roundRankingService = new();

public RoundRankingEventControllerTests()
{
InitMock(_roundRankingService);
}

[Fact]
public async Task Consumes_Checkpoint_Data()
{
Controller.OnWaypointAsync(null,
new WayPointEventArgs
{
Login = "*fakeplayer1*",
AccountId = "*fakeplayer1*",
RaceTime = 0,
LapTime = 0,
CheckpointInRace = 0,
CheckpointInLap = 0,
IsEndRace = false,
IsEndLap = false,
CurrentRaceCheckpoints = [],
CurrentLapCheckpoints = [],
BlockId = "",
Speed = 0,
Time = 0
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace EvoSC.Modules.Official.RoundRankingModule.Tests.Models;

public class CheckpointsRepositoryTests
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>EvoSC.Modules.Official.RoundRankingModule.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\EvoSC.Testing\EvoSC.Testing.csproj" />
<ProjectReference Include="..\..\..\src\Modules\RoundRankingModule\RoundRankingModule.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="xunit.core">
<HintPath>..\..\..\..\..\.nuget\packages\xunit.extensibility.core\2.8.1\lib\netstandard1.1\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace EvoSC.Modules.Official.RoundRankingModule.Tests.Services;

public class RoundRankingServiceTests
{

}

0 comments on commit 80fb3d6

Please sign in to comment.