public virtual Response Process(SessionActivity sessionActivity) { var response = new Response(); var coverages = _coverageMiner.Mine(sessionActivity); foreach (var coverage in coverages) { var valid = _coverageValidator.Validate(coverage); if (!valid) { response.Message = "The coverage is not valid"; return(response); } var coverageModel = _coverageMapper.Map(coverage); var responseModel = _coverageSender.Send(coverageModel); if (!responseModel.Successful) { response.Message = responseModel.Message; return(response); } response = _responseMapper.Map(responseModel); } response.Successful = true; response.Message = "The policy has been received"; return(response); }
public void Send() { _coverageReceiverMock.Setup(c => c.Receive(_coverageModel)).Returns(_responseModel); var result = _coverageSender.Send(_coverageModel); Assert.IsInstanceOfType(result, typeof(ResponseModel)); _coverageReceiverMock.Verify(c => c.Receive(_coverageModel), Times.Once); _coverageReceiverMock.VerifyNoOtherCalls(); }
public void Send() { _coverageReceiverMock.Setup(c => c.Receive(_coverageModel)).Returns(_responseModel); var result = _coverageSender.Send(_coverageModel); Assert.AreSame(_responseModel, result); _coverageReceiverMock.Verify(c => c.Receive(_coverageModel), Times.Once); _coverageReceiverMock.VerifyNoOtherCalls(); }