public void ShouldStartCallWithRealNumber() { var mockNotificationService = new Mock <INotificationService>(); var mockControllerProperties = new ControllerPropertiesMock(); var controller = new CallCenterController(mockNotificationService.Object) { ControllerContext = mockControllerProperties.ControllerContext, Url = mockControllerProperties.Url(RouteConfig.RegisterRoutes) }; var callViewModel = new CallViewModel { UserNumber = "user-number", SalesNumber = "sales-number" }; controller .WithCallTo(c => c.Call(callViewModel)) .ShouldReturnJson(data => { Assert.That(data.message, Is.EqualTo("Phone call incoming!")); }); const string expectedUriHandler = "http://www.example.com/Call/Connect?salesNumber=sales-number"; mockNotificationService.Verify( s => s.MakePhoneCallAsync("user-number", "twilio-number", expectedUriHandler), Times.Once()); }
public void SetUp() { var controllerPropertiesMock = new ControllerPropertiesMock(); _controller = new MenuController { ControllerContext = controllerPropertiesMock.ControllerContext, Url = controllerPropertiesMock.Url(RouteConfig.RegisterRoutes) }; }
public void GivenAWelcomeAction_ThenTheResponseContainsGatherPlay() { var controllerPropertiesMock = new ControllerPropertiesMock(); var controller = new IVRController { ControllerContext = controllerPropertiesMock.ControllerContext, Url = controllerPropertiesMock.Url(RouteConfig.RegisterRoutes) }; controller.WithCallTo(c => c.Welcome()) .ShouldReturnTwiMLResult(data => { Assert.That(data.XPathSelectElement("Response/Gather/Say"), Is.Not.Null); Assert.That(data.XPathSelectElement("Response/Gather").Attribute("action").Value, Is.EqualTo("/Menu/Show")); }); }