public void LoadCommentsProgressBarCallsSuccessTest() { var viewModel = new PostDetailsViewModel(null, postServiceClientMock.Object, commentServiceClientMock.Object, windowManagerMock.Object, progressBarMock.Object, null); viewModel.LoadComments(null); progressBarMock.Verify(x => x.Show(), Times.Exactly(1)); }
public void LoadCommentsThrowExceptionSuccessTest() { var viewModel = new PostDetailsViewModel(null, postServiceClientMock.Object, commentServiceClientMock.Object, windowManagerMock.Object, progressBarMock.Object, null); postServiceClientMock.Setup(x => x.Get(It.IsAny <string>())).Throws(new ConnectionTimeoutException()); viewModel.LoadComments(null); windowManagerMock.Verify(x => x.ShowDialog(It.IsAny <object>(), null, null), Times.Exactly(1)); }
public void LoadCommentsSuccessTest() { commentServiceClientMock.Setup(summariesService => summariesService.Get(It.IsAny <string>())).Returns(() => { var task = new Task <List <Comment> >(() => comments); task.Start(); task.Wait(); return(task); }); var viewModel = new PostDetailsViewModel(null, postServiceClientMock.Object, commentServiceClientMock.Object, windowManagerMock.Object, progressBarMock.Object, null); viewModel.LoadComments(null); Assert.AreNotEqual(null, viewModel.Comments); Assert.AreNotEqual(0, viewModel.Comments.Count); Assert.AreEqual(comments.Count, viewModel.Comments.Count); }