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">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Lib\Localization\Translations.yml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WikipediaApi\WikipediaApi.csproj" />

View file

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