diff --git a/tests/EvoSC.Common.Tests/Services/MapServiceTests.cs b/tests/EvoSC.Common.Tests/Services/MapServiceTests.cs index bc05ed42d..fc2ca4cbe 100644 --- a/tests/EvoSC.Common.Tests/Services/MapServiceTests.cs +++ b/tests/EvoSC.Common.Tests/Services/MapServiceTests.cs @@ -14,8 +14,10 @@ using EvoSC.Common.Models.Maps; using EvoSC.Common.Services; using EvoSC.Testing; +using GbxRemoteNet; using GbxRemoteNet.Interfaces; using GbxRemoteNet.Structs; +using GbxRemoteNet.XmlRpc.ExtraTypes; using Microsoft.Extensions.Logging; using Moq; using Xunit; @@ -370,6 +372,7 @@ public async Task Add_Current_Map_List_Adds_Maplist() { Name = "snippens dream", Author = "0efeba8a-9cda-49fa-ab25-35f1d9218c95", + AuthorNickname = "snippen", AuthorTime = 1337, BronzeTime = 1337, CopperPrice = 1337, @@ -388,10 +391,32 @@ public async Task Add_Current_Map_List_Adds_Maplist() UpdatedAt = new DateTime(), LastVisit = new DateTime() }; - _server.Remote.Setup(r => r.GetMapListAsync(It.IsAny(), It.IsAny())) .Returns(Task.FromResult(new[] { tmMapInfo })); - _playerService.Setup(p => p.GetOrCreatePlayerAsync(It.IsAny())) + _server.Remote.Setup(r => r.MultiCallAsync(It.IsAny())) + .ReturnsAsync([ + new GbxDynamicObject() + { + { "UId", tmMapInfo.UId }, + { "Name", tmMapInfo.Name }, + { "FileName", tmMapInfo.FileName }, + { "Author", tmMapInfo.Author }, + { "AuthorNickname", tmMapInfo.AuthorNickname }, + { "Environnement", tmMapInfo.Environnement }, + { "Mood", tmMapInfo.Mood }, + { "BronzeTime", tmMapInfo.BronzeTime }, + { "SilverTime", tmMapInfo.SilverTime }, + { "GoldTime", tmMapInfo.GoldTime }, + { "AuthorTime", tmMapInfo.AuthorTime }, + { "CopperPrice", tmMapInfo.CopperPrice }, + { "LapRace", tmMapInfo.LapRace }, + { "NbLaps", tmMapInfo.NbLaps }, + { "NbCheckpoints", tmMapInfo.NbCheckpoints }, + { "MapType", tmMapInfo.MapType }, + { "MapStyle", tmMapInfo.MapStyle } + } + ]); + _playerService.Setup(p => p.GetOrCreatePlayerAsync(It.IsAny(), "snippen")) .Returns(Task.FromResult((IPlayer)player)); await _mapService.AddCurrentMapListAsync(); @@ -407,6 +432,7 @@ public async Task Get_Or_Add_Current_Map_Returns_Current_Map() { Name = "snippens track", Author = "0efeba8a-9cda-49fa-ab25-35f1d9218c95", + AuthorNickname = "snippen", AuthorTime = 1337, BronzeTime = 1337, CopperPrice = 1337, @@ -452,7 +478,7 @@ public async Task Get_Or_Add_Current_Map_Returns_Current_Map() .Returns(Task.FromResult((IMap?)null)); _mapRepository.Setup(m => m.AddMapAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(Task.FromResult((IMap)map)); - _playerService.Setup(p => p.GetOrCreatePlayerAsync(It.IsAny())) + _playerService.Setup(p => p.GetOrCreatePlayerAsync(It.IsAny(), "snippen")) .Returns(Task.FromResult((IPlayer)player)); var retrievedMap = await _mapService.GetOrAddCurrentMapAsync();