public void Ok() { // Arrange. var candidateId = Guid.NewGuid(); var savedSearchId = Guid.NewGuid(); var candidateService = new Mock <ICandidateServiceProvider>(); candidateService.Setup(cs => cs.DeleteSavedSearch(candidateId, savedSearchId)) .Returns(new SavedSearchViewModel()); var mediator = new AccountMediatorBuilder().With(candidateService).Build(); // Act. var response = mediator.DeleteSavedSearch(candidateId, savedSearchId); // Assert. response.AssertCode(AccountMediatorCodes.DeleteSavedSearch.Ok, true); candidateService.Verify(cs => cs.DeleteSavedSearch(candidateId, savedSearchId), Times.Once); }
public void HasError() { // Arrange. var candidateId = Guid.NewGuid(); var savedSearchId = Guid.NewGuid(); var candidateService = new Mock <ICandidateServiceProvider>(); candidateService.Setup(cs => cs.DeleteSavedSearch(candidateId, savedSearchId)) .Returns(new SavedSearchViewModel { ViewModelMessage = "Error" }); var mediator = new AccountMediatorBuilder().With(candidateService).Build(); // Act. var response = mediator.DeleteSavedSearch(candidateId, savedSearchId); // Assert. response.AssertMessage(AccountMediatorCodes.DeleteSavedSearch.HasError, AccountPageMessages.DeleteSavedSearchFailed, UserMessageLevel.Error, true); candidateService.Verify(cs => cs.DeleteSavedSearch(candidateId, savedSearchId), Times.Once); }