public void SendMessageOk() { var candidateId = Guid.NewGuid(); var candidateServiceProvider = new CandidateServiceProvider( _candidateServiceMock.Object, null, null, null, _mapperMock.Object, null, null); _mapperMock.Setup(m => m.Map <FeedbackViewModel, ContactMessage>(It.IsAny <FeedbackViewModel>())) .Returns(new ContactMessage()); var result = candidateServiceProvider.SendFeedback(candidateId, new FeedbackViewModel()); result.Should().BeTrue(); _candidateServiceMock.Verify(cs => cs.SubmitContactMessage(It.Is <ContactMessage>(cm => cm.UserId == candidateId))); }
public void SendMessageFail() { var candidateId = Guid.NewGuid(); var candidateServiceProvider = new CandidateServiceProvider( _candidateServiceMock.Object, null, null, null, _mapperMock.Object, null, null); _mapperMock.Setup(m => m.Map <FeedbackViewModel, ContactMessage>(It.IsAny <FeedbackViewModel>())) .Returns(new ContactMessage()); _candidateServiceMock.Setup(cs => cs.SubmitContactMessage(It.IsAny <ContactMessage>())) .Throws <ArgumentException>(); var result = candidateServiceProvider.SendFeedback(candidateId, new FeedbackViewModel()); result.Should().BeFalse(); }