示例#1
0
        public void Enqueue_EnqueuesTheSelectedProduct(string digits, string selectedProduct)
        {
            var controller = new CallController();

            controller.WithCallTo(c => c.Enqueue(digits))
            .ShouldReturnTwiMLResult(data =>
            {
                StringAssert.Contains(
                    selectedProduct, data.XPathSelectElement("Response/Enqueue").Value);
            });
        }
示例#2
0
        public void Incoming_RespondsWithWelcomeMessage()
        {
            var controller = new CallController();

            controller.WithCallTo(c => c.Incoming())
            .ShouldReturnTwiMLResult(data =>
            {
                StringAssert.Contains(
                    "For Programmable SMS", data.XPathSelectElement("Response/Gather/Say").Value);
            });
        }
        public void ShouldRespondUnauthorizedOnInvalidRequest()
        {
            _mockValidatorService
            .Setup(service => service.IsValidRequest(It.IsAny <HttpContext>(), It.IsAny <string>()))
            .Returns(false);

            var controller = new CallController(_mockValidatorService.Object);

            controller
            .WithCallTo(c => c.Connect("sales-number"))
            .ShouldGiveHttpStatus(HttpStatusCode.Unauthorized);
        }
        public void ShouldRespondWithTwiMLOnValidRequest()
        {
            _mockValidatorService
            .Setup(service => service.IsValidRequest(It.IsAny <HttpContext>(), It.IsAny <string>()))
            .Returns(true);

            var controller = new CallController(_mockValidatorService.Object);

            controller
            .WithCallTo(c => c.Connect("sales-number"))
            .ShouldReturnTwiMLResult(data =>
            {
                StringAssert.Contains(
                    "Thanks for contacting", data.XPathSelectElement("Response/Say").Value);
                Assert.That(data.XPathSelectElement("Response/Dial").Value, Is.EqualTo("sales-number"));
            });
        }