chore: Linux path for fixture fixed

This commit is contained in:
Mikhail Shabanov committed 2021-03-12 17:56:13 +01:00
1 parent a9eab26a6d
commit 7f713e5357
4 files changed
+18 -14

No files matched your search

@@ -46,10 +46,10 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
var accountInfoHistorySerialized = JsonConvert.SerializeObject(_contextData.AccountInfoHistory); var accountInfoHistorySerialized = JsonConvert.SerializeObject(_contextData.AccountInfoHistory);
var expectedAccountInfo = var expectedAccountInfo =
await File.ReadAllTextAsync($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedAccountInfo.json"); await File.ReadAllTextAsync(GetFixturePath("MappedAccountInfo.json"));
accountInfoSerialized.Should().Be(expectedAccountInfo); accountInfoSerialized.Should().Be(expectedAccountInfo);
var expectedAccountInfoHistory = var expectedAccountInfoHistory =
await File.ReadAllTextAsync($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedAccountHistory.json"); await File.ReadAllTextAsync(GetFixturePath("MappedAccountHistory.json"));
accountInfoHistorySerialized.Should().Be(expectedAccountInfoHistory); accountInfoHistorySerialized.Should().Be(expectedAccountInfoHistory);
} }
} }
@@ -45,10 +45,10 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
var tanksHistorySerialized = JsonConvert.SerializeObject(_contextData.TanksHistory); var tanksHistorySerialized = JsonConvert.SerializeObject(_contextData.TanksHistory);
var expectedTanksInfo = var expectedTanksInfo =
await File.ReadAllTextAsync($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedTanks.json"); await File.ReadAllTextAsync(GetFixturePath("MappedTanks.json"));
tanksSerialized.Should().Be(expectedTanksInfo); tanksSerialized.Should().Be(expectedTanksInfo);
var expectedTanksHistory = var expectedTanksHistory =
await File.ReadAllTextAsync($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedTanksHistory.json"); await File.ReadAllTextAsync(GetFixturePath("MappedTanksHistory.json"));
tanksHistorySerialized.Should().Be(expectedTanksHistory); tanksHistorySerialized.Should().Be(expectedTanksHistory);
} }
@@ -63,10 +63,10 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
var settingsMock = new Mock<IWargamingApiSettings>(); var settingsMock = new Mock<IWargamingApiSettings>();
settingsMock.SetupGet(s => s.ApplicationId).Returns(ApplicationId); settingsMock.SetupGet(s => s.ApplicationId).Returns(ApplicationId);
var playerInfoFilePath = $"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\PlayerInfo50.json"; var playerInfoFilePath = GetFixturePath("PlayerInfo50.json");
var tanksInfoFilePath = $"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\TanksInfo50.json"; var tanksInfoFilePath = GetFixturePath("TanksInfo50.json");
var playerAchievementsFilePath = $"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\PlayerAchievements50.json"; var playerAchievementsFilePath = GetFixturePath("PlayerAchievements50.json");
var tanksAchievementsFilePath = $"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\TanksAchievemnts50.json"; var tanksAchievementsFilePath = GetFixturePath("TanksAchievemnts50.json");
var playerInfoRequestUrl = $"https://api.wotblitz.eu/wotb/account/info/?application_id={ApplicationId}&language=en&account_id={AccountId}"; var playerInfoRequestUrl = $"https://api.wotblitz.eu/wotb/account/info/?application_id={ApplicationId}&language=en&account_id={AccountId}";
var playerInfoResponse = new HttpResponseMessage var playerInfoResponse = new HttpResponseMessage
@@ -105,7 +105,7 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
protected void InitDataAccessors() protected void InitDataAccessors()
{ {
var tankopediaFile = File.ReadAllText($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\Tankopedia.json"); var tankopediaFile = File.ReadAllText(GetFixturePath("Tankopedia.json"));
var vehicles = JsonConvert.DeserializeObject<List<VehiclesDictionary>>(tankopediaFile); var vehicles = JsonConvert.DeserializeObject<List<VehiclesDictionary>>(tankopediaFile);
var tankTires = vehicles.Select(v => new {TankId = v.TankId, Tier = v.Tier}) var tankTires = vehicles.Select(v => new {TankId = v.TankId, Tier = v.Tier})
@@ -122,9 +122,9 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
protected void FillAccountAndTanks(AccountInformationPipelineContextData contextData) protected void FillAccountAndTanks(AccountInformationPipelineContextData contextData)
{ {
var mappedAccountInfoHistory = File.ReadAllText($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedAccountHistory.json"); var mappedAccountInfoHistory = File.ReadAllText(GetFixturePath("MappedAccountHistory.json"));
var mappedTanks = File.ReadAllText($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedTanks.json"); var mappedTanks = File.ReadAllText(GetFixturePath("MappedTanks.json"));
var mappedTanksHistory = File.ReadAllText($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedTanksHistory.json"); var mappedTanksHistory = File.ReadAllText(GetFixturePath("MappedTanksHistory.json"));
contextData.AccountInfo = GetAccountInfoFromFixture(); contextData.AccountInfo = GetAccountInfoFromFixture();
contextData.AccountInfoHistory = contextData.AccountInfoHistory =
@@ -137,9 +137,13 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
protected AccountInfo GetAccountInfoFromFixture() protected AccountInfo GetAccountInfoFromFixture()
{ {
var mappedAccountInfo = File.ReadAllText($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedAccountInfo.json"); var mappedAccountInfo = File.ReadAllText(GetFixturePath("MappedAccountInfo.json"));
return JsonConvert.DeserializeObject<AccountInfo>(mappedAccountInfo); return JsonConvert.DeserializeObject<AccountInfo>(mappedAccountInfo);
} }
protected string GetFixturePath(string fixtureFileName)
{
return Path.Combine(TestContext.CurrentContext.TestDirectory, "Fixtures", fixtureFileName);
}
} }
} }
@@ -38,7 +38,7 @@ namespace WotBlitzStatisticsPro.Tests.OperationStepsTests
var accountInfoSerialized = JsonConvert.SerializeObject(_contextData.DbAccountInfo); var accountInfoSerialized = JsonConvert.SerializeObject(_contextData.DbAccountInfo);
var expectedAccountInfo = var expectedAccountInfo =
await File.ReadAllTextAsync($"{TestContext.CurrentContext.TestDirectory}\\Fixtures\\MappedAccountInfo.json"); await File.ReadAllTextAsync(GetFixturePath("MappedAccountInfo.json"));
accountInfoSerialized.Should().Be(expectedAccountInfo); accountInfoSerialized.Should().Be(expectedAccountInfo);
} }