mirror of
https://github.com/abdelkader/vCardEditor
synced 2025-12-12 08:27:19 +07:00
fixed test
This commit is contained in:
@@ -44,5 +44,26 @@
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string InvalidJsonValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return @"{
|
||||
""version"": ""1.0"",
|
||||
""languages"": {
|
||||
""en"": {
|
||||
""name"": ""English"",
|
||||
""messages"": {
|
||||
""MSG_001"": ""Save current file before?"",
|
||||
""MSG_002"": ""File""
|
||||
_002"": ""Fichier""
|
||||
}
|
||||
}
|
||||
}
|
||||
}";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using vCardEditor.Libs.TinyJson;
|
||||
using vCardEditor.Repository;
|
||||
|
||||
@@ -22,5 +21,18 @@ namespace vCardEditor_Test
|
||||
Assert.IsTrue(embeddedlang.languages.Count == 2, "Number of json entries invalid");
|
||||
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IncorrectJsonLoaded_Test()
|
||||
{
|
||||
var fileHandler = Substitute.For<IFileHandler>();
|
||||
fileHandler.LoadJsonFromAssembly(Arg.Any<string>()).Returns(JsonEntries.InvalidJsonValid);
|
||||
var JsonParser = new TinyJsonParser();
|
||||
|
||||
var embeddedlang = new LocalizationLoader(JsonParser, fileHandler).LoadEmbedded();
|
||||
|
||||
|
||||
Assert.IsTrue(embeddedlang.version == "1.0", "Json version incorrect");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace vCardEditor_Test
|
||||
|
||||
view.NewFileOpened += Raise.EventWith(new EventArg<string>("filename.vcf"));
|
||||
repo.Contacts[1].isDirty = true;
|
||||
|
||||
fileHandler.FileExist(Arg.Any<string>()).Returns(false);
|
||||
view.NewFileOpened += Raise.EventWith(new EventArg<string>("filename2.vcf"));
|
||||
|
||||
view.Received().AskMessage(Arg.Any<string>(), Arg.Any<string>());
|
||||
|
||||
Reference in New Issue
Block a user