Updated DLSiteClient test to handle translations. Added Alingual to the list of "All" supported languages.
This commit is contained in:
@@ -18,7 +18,8 @@ public sealed record SupportedLanguage(string Code, Language Language)
|
|||||||
English,
|
English,
|
||||||
ChineseSimplified,
|
ChineseSimplified,
|
||||||
ChineseTraditional,
|
ChineseTraditional,
|
||||||
Korean
|
Korean,
|
||||||
|
Alingual
|
||||||
];
|
];
|
||||||
|
|
||||||
private static readonly Dictionary<string, SupportedLanguage> _byCode =
|
private static readonly Dictionary<string, SupportedLanguage> _byCode =
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using JSMR.Application.Integrations.DLSite.Models;
|
using JSMR.Application.Integrations.DLSite.Models;
|
||||||
using JSMR.Domain.Enums;
|
using JSMR.Domain.Enums;
|
||||||
|
using JSMR.Domain.ValueObjects;
|
||||||
using JSMR.Infrastructure.Http;
|
using JSMR.Infrastructure.Http;
|
||||||
using JSMR.Infrastructure.Integrations.DLSite;
|
using JSMR.Infrastructure.Integrations.DLSite;
|
||||||
using JSMR.Infrastructure.Integrations.DLSite.Mapping;
|
using JSMR.Infrastructure.Integrations.DLSite.Mapping;
|
||||||
@@ -60,25 +61,61 @@ public class DLSiteClientTests
|
|||||||
TitleId = "SE0001",
|
TitleId = "SE0001",
|
||||||
TitleName = "Series 1"
|
TitleName = "Series 1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RG0002",
|
||||||
|
new ProductInfo()
|
||||||
|
{
|
||||||
|
WishlistCount = 100,
|
||||||
|
DownloadCount = 50,
|
||||||
|
Options = ["TRI", "ENG", "DOT", "VET"],
|
||||||
|
TitleId = "SE0001",
|
||||||
|
TitleName = "Series 1",
|
||||||
|
TranslationInfo = new()
|
||||||
|
{
|
||||||
|
OriginalWorkNumber = "RG0001",
|
||||||
|
Language = "ENG"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// General
|
||||||
VoiceWorkDetailCollection mappedCollection = DLSiteToDomainMapper.Map(productInfoCollection);
|
VoiceWorkDetailCollection mappedCollection = DLSiteToDomainMapper.Map(productInfoCollection);
|
||||||
mappedCollection.Count.ShouldBe(1);
|
mappedCollection.Count.ShouldBe(2);
|
||||||
mappedCollection.ShouldContainKey("RG0001");
|
mappedCollection.ShouldContainKey("RG0001");
|
||||||
|
mappedCollection.ShouldContainKey("RG0002");
|
||||||
|
|
||||||
|
// RG0001
|
||||||
VoiceWorkDetails voiceWorkDetails = mappedCollection["RG0001"];
|
VoiceWorkDetails voiceWorkDetails = mappedCollection["RG0001"];
|
||||||
voiceWorkDetails.WishlistCount.ShouldBe(250);
|
voiceWorkDetails.WishlistCount.ShouldBe(250);
|
||||||
voiceWorkDetails.DownloadCount.ShouldBe(100);
|
voiceWorkDetails.DownloadCount.ShouldBe(100);
|
||||||
voiceWorkDetails.HasTrial.ShouldBe(true);
|
voiceWorkDetails.HasTrial.ShouldBe(true);
|
||||||
voiceWorkDetails.HasDLPlay.ShouldBe(true);
|
voiceWorkDetails.HasDLPlay.ShouldBe(true);
|
||||||
voiceWorkDetails.AI.ShouldBe(AIGeneration.None);
|
voiceWorkDetails.AI.ShouldBe(AIGeneration.None);
|
||||||
|
voiceWorkDetails.SupportedLanguages.ShouldBe([SupportedLanguage.Japanese]);
|
||||||
|
|
||||||
voiceWorkDetails.Series.ShouldNotBeNull();
|
voiceWorkDetails.Series.ShouldNotBeNull();
|
||||||
voiceWorkDetails.Series.Identifier.ShouldBe("SE0001");
|
voiceWorkDetails.Series.Identifier.ShouldBe("SE0001");
|
||||||
voiceWorkDetails.Series.Name.ShouldBe("Series 1");
|
voiceWorkDetails.Series.Name.ShouldBe("Series 1");
|
||||||
|
|
||||||
voiceWorkDetails.SupportedLanguages.Count.ShouldBe(1);
|
|
||||||
voiceWorkDetails.SupportedLanguages[0].Language.ShouldBe(Language.Japanese);
|
// RG0002
|
||||||
|
VoiceWorkDetails secondVoiceWorkDetails = mappedCollection["RG0002"];
|
||||||
|
secondVoiceWorkDetails.WishlistCount.ShouldBe(100);
|
||||||
|
secondVoiceWorkDetails.DownloadCount.ShouldBe(50);
|
||||||
|
secondVoiceWorkDetails.HasTrial.ShouldBe(true);
|
||||||
|
secondVoiceWorkDetails.HasDLPlay.ShouldBe(false);
|
||||||
|
secondVoiceWorkDetails.AI.ShouldBe(AIGeneration.None);
|
||||||
|
secondVoiceWorkDetails.SupportedLanguages.ShouldBe([SupportedLanguage.English]);
|
||||||
|
|
||||||
|
secondVoiceWorkDetails.Series.ShouldNotBeNull();
|
||||||
|
secondVoiceWorkDetails.Series.Identifier.ShouldBe("SE0001");
|
||||||
|
secondVoiceWorkDetails.Series.Name.ShouldBe("Series 1");
|
||||||
|
|
||||||
|
secondVoiceWorkDetails.Translation.ShouldNotBeNull();
|
||||||
|
secondVoiceWorkDetails.Translation.OriginalProductId.ShouldBe("RG0001");
|
||||||
|
secondVoiceWorkDetails.Translation.Language.ShouldBe(Language.English);
|
||||||
|
secondVoiceWorkDetails.Translation.Kind.ShouldBe(TranslationKind.Official | TranslationKind.Recommended);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user