mirror of
https://github.com/abdelkader/vCardEditor
synced 2025-12-12 08:27:19 +07:00
added a test for SaveSplittedFile
This commit is contained in:
@@ -273,5 +273,28 @@ namespace vCardEditor_Test
|
||||
Assert.IsTrue(repo.Contacts.Count == 1);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SaveSplittedFile_ShouldCall3TimesFileSaving_Test()
|
||||
{
|
||||
|
||||
var fileHandler = Substitute.For<IFileHandler>();
|
||||
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfFourEntry);
|
||||
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
|
||||
|
||||
var repo = Substitute.For<ContactRepository>(fileHandler);
|
||||
|
||||
repo.LoadContacts("aaa.vcf");
|
||||
repo.Contacts[3].isDeleted = true;
|
||||
|
||||
var view = Substitute.For<IMainView>();
|
||||
view.DisplayOpenFolderDialog().Returns("aaa");
|
||||
_ = new MainPresenter(view, repo);
|
||||
view.SplitFileEvent += Raise.Event();
|
||||
|
||||
//Should save only 3 files.
|
||||
fileHandler.Received(3).WriteAllText(Arg.Any<string>(), Arg.Any<string>());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user