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);
        }
Exemple #2
0
        public void Map()
        {
            // Act
            var result = _coverageMapper.Map(_coverage);

            // Assert
            Assert.IsInstanceOfType(result, typeof(CoverageModel));
        }
Exemple #3
0
        public void Map()
        {
            var result = _coverageMapper.Map(_coverage);

            Assert.IsInstanceOfType(result, typeof(CoverageModel));
            Assert.AreEqual("Coverage 1", result.NameOfCoverage);
            Assert.AreEqual(5, result.PolicyId);
        }