Esempio n. 1
0
        public void Send()
        {
            var policySender = new PolicySender();
            var policyModel  = new PolicyModel();

            var responseModel = policySender.Send(policyModel);

            Assert.IsInstanceOfType(responseModel, typeof(ResponseModel));
        }
        public void Send()
        {
            _policyReceiverMock.Setup(c => c.Receive(_policyModel)).Returns(_responseModel);

            var result = _policySender.Send(_policyModel);

            Assert.IsInstanceOfType(result, typeof(ResponseModel));

            _policyReceiverMock.Verify(c => c.Receive(_policyModel), Times.Once);
            _policyReceiverMock.VerifyNoOtherCalls();
        }
Esempio n. 3
0
        public void Send()
        {
            // Arrange
            _policyReceiverMock.Setup(c => c.Receive(_policyModel)).Returns(_responseModel);

            // Act
            var result = _policySender.Send(_policyModel);

            // Assert
            Assert.AreSame(_responseModel, result);

            _policyReceiverMock.Verify(c => c.Receive(_policyModel), Times.Once);

            _policyReceiverMock.VerifyNoOtherCalls();
        }
        public Response Process(SessionActivity sessionActivity)
        {
            var policyMiner = new PolicyMiner();
            var policy      = policyMiner.Mine(sessionActivity);

            var policyMapper = new PolicyMapper();
            var policyModel  = policyMapper.Map(policy);

            var policySender  = new PolicySender();
            var responseModel = policySender.Send(policyModel);

            var responseMapper = new ResponseMapper();
            var response       = responseMapper.Map(responseModel);

            return(response);
        }
        public virtual Response Process(SessionActivity sessionActivity)
        {
            var policy     = _policyMiner.Mine(sessionActivity);
            var validation = _policyValidator.Validate(policy);

            if (validation == false)
            {
                return(new Response
                {
                    Message = "Failed validation",
                    Successful = false
                });
            }

            var policyModel   = _policyMapper.Map(policy);
            var responseModel = _policySender.Send(policyModel);
            var response      = _responseMapper.Map(responseModel);

            return(response);
        }
        public virtual Response Process(SessionActivity sessionActivity)
        {
            var policy = _policyMiner.Mine(sessionActivity);
            var valid  = _policyValidator.Validate(policy);

            if (!valid)
            {
                Response failedResponse = new Response
                {
                    Successful = false,
                    Message    = "This response is not valid"
                };

                return(failedResponse);
            }

            var policyModel   = _policyMapper.Map(policy);
            var responseModel = _policySender.Send(policyModel);
            var response      = _responseMapper.Map(responseModel);

            return(response);
        }