Skip to content

Commit

Permalink
Update EveWHMapperHelperTest.cs (#135)
Browse files Browse the repository at this point in the history
add extra test getWHClass from SolarSystem model
fix : Task<EveSystemType> GetWHClass(SolarSystem whSystem)
  • Loading branch information
pfh59 authored Sep 14, 2023
1 parent 35dd8bf commit 3fa16b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion WHMapper.Tests/WHHelper/EveWHMapperHelperTest.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System;
using System.Threading;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using WHMapper.Models.Db;
using WHMapper.Models.DTO.EveAPI;
using WHMapper.Models.DTO.EveMapper.Enums;
using WHMapper.Services.Anoik;
using WHMapper.Services.EveAPI;
Expand All @@ -28,6 +29,7 @@ public class EveWHMapperHelperTest

private const int SOLAR_SYSTEM_WH_ID = 31001123;
private const string SOLAR_SYSTEM_WH_NAME = "J165153";
private const int CONSTELLATION_WH_ID = 21000113;
private const string CONSTELLATION_WH_NAME = "C-C00113";
private const string REGION_WH_NAME = "C-R00012";
private const EveSystemType SOLAR_SYSTEM_WH_CLASS = EveSystemType.C3;
Expand Down Expand Up @@ -104,6 +106,9 @@ public async Task Is_Wormhole()
[Fact, Priority(2)]
public async Task Get_Wormhole_Class()
{
var result_C3_Bis= await _whEveMapper.GetWHClass(new Models.DTO.EveAPI.Universe.SolarSystem(0, 31001123, SOLAR_SYSTEM_WH_NAME,null,-1.0f,string.Empty,CONSTELLATION_WH_ID,null,null));
Assert.Equal(EveSystemType.C3, result_C3_Bis);

var result_HS = await _whEveMapper.GetWHClass(REGION_JITA_NAME, "UNUSED", SOLAR_SYSTEM_JITA_NAME);
Assert.Equal(EveSystemType.None, result_HS);

Expand Down
5 changes: 2 additions & 3 deletions WHMapper/Services/EveMapper/EveMapperHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -546,7 +546,7 @@ public async Task<EveSystemType> GetWHClass(SolarSystem whSystem)
var system_constellation = await _universeServices.GetContellation(whSystem.ConstellationId);
var system_region = await _universeServices.GetRegion(system_constellation.RegionId);

return await GetWHClass(whSystem.Name, system_constellation.Name, system_region.Name);
return await GetWHClass(system_region.Name, system_constellation.Name, whSystem.Name);
}
return EveSystemType.None;
}
Expand Down Expand Up @@ -787,4 +787,3 @@ await Parallel.ForEachAsync(whGroup.Types, _options, async (whTypeId, token) =>

}
}

0 comments on commit 3fa16b7

Please sign in to comment.