Fix Unit tests

This commit is contained in:
runebaas 2019-05-12 15:57:58 +02:00
parent 53f894676c
commit 5efb146d18
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
2 changed files with 14 additions and 11 deletions

View file

@ -94,6 +94,9 @@
<None Update="Storage\dab"> <None Update="Storage\dab">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="Lib\Localization\Translations.yml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\WikipediaApi\WikipediaApi.csproj" /> <ProjectReference Include="..\WikipediaApi\WikipediaApi.csproj" />

View file

@ -48,22 +48,22 @@ namespace Tests.Lib.Localization
{ {
var translationHandlerMock = new Mock<ITranslationHandler>(MockBehavior.Loose); var translationHandlerMock = new Mock<ITranslationHandler>(MockBehavior.Loose);
translationHandlerMock translationHandlerMock
.Setup(thm => thm.GetStrings("EN", "dateTime", "Days")) .Setup(thm => thm.GetString("EN", "dateTime", "Days"))
.Returns(new List<string> {{"day"}, {"days"}}); .Returns("day|days");
translationHandlerMock translationHandlerMock
.Setup(thm => thm.GetStrings("EN", "dateTime", "Hours")) .Setup(thm => thm.GetString("EN", "dateTime", "Hours"))
.Returns(new List<string> {{"hour"}, {"hours"}}); .Returns("hour|hours");
translationHandlerMock translationHandlerMock
.Setup(thm => thm.GetStrings("EN", "dateTime", "Minutes")) .Setup(thm => thm.GetString("EN", "dateTime", "Minutes"))
.Returns(new List<string> {{"minute"}, {"minutes"}}); .Returns("minute|minutes");
translationHandlerMock translationHandlerMock
.Setup(thm => thm.GetStrings("EN", "dateTime", "Seconds")) .Setup(thm => thm.GetString("EN", "dateTime", "Seconds"))
.Returns(new List<string> {{"second"}, {"seconds"}}); .Returns("second|seconds");
translationHandlerMock translationHandlerMock
.Setup(thm => thm.GetStrings("EN", "dateTime", "And")) .Setup(thm => thm.GetString("EN", "dateTime", "And"))
.Returns(new List<string> {{"and"}}); .Returns("and");
var context = new TranslationGuildContext(translationHandlerMock.Object, "EN", new Dictionary<string, List<string>>()); var context = new TranslationGuildContext(translationHandlerMock.Object, "EN", new Dictionary<string, string>());
var result = context.FormatDateTimeAsRemaining(testData.DateTime); var result = context.FormatDateTimeAsRemaining(testData.DateTime);
Assert.Equal(result, testData.Expected); Assert.Equal(result, testData.Expected);
} }