public void When_get_index_Then_should_return_correct_viewmodel_type() { // Given var controller = GetTarget(); var viewModel = new PersonalRiskAssessmentReviewsViewModel(); _viewModelFactory .Setup(x => x.GetViewModel()) .Returns(viewModel); // When var result = controller.Index(_companyId, _riskAssessmentId) as ViewResult; // Then Assert.That(result.Model, Is.TypeOf<PersonalRiskAssessmentReviewsViewModel>()); }
public void When_get_index_Then_should_call_appropiate_methods() { // Given var controller = GetTarget(); var viewModel = new PersonalRiskAssessmentReviewsViewModel(); _viewModelFactory .Setup(x => x.GetViewModel()) .Returns(viewModel); // When controller.Index(_companyId, _riskAssessmentId); // Then _viewModelFactory.VerifyAll(); }