Last active
June 15, 2018 22:49
-
-
Save FraukeN/4b8e93a49c75401a89eef3ee5158368c to your computer and use it in GitHub Desktop.
OverviewVMTests with test for repo exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public async Task LoadData_sets_IsFaulted_to_true_if_LoadData_encounters_an_exception() | |
{ | |
// Arrange | |
Mock<IRepository<ToDoItem>> repoMock = new Mock<IRepository<ToDoItem>>(); | |
repoMock.Setup(repo => repo.GetAsync()).ThrowsAsync(new Exception()); | |
OverviewVM vm = new OverviewVM(repoMock.Object); | |
// Act | |
await vm.LoadData(); | |
// Assert | |
Assert.That(vm.IsFaulted, Is.True); | |
Assert.That(vm.ErrorMessage, Is.EqualTo("Unable to Load ToDo Items")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment