예제 #1
0
        public void Route_Should_InvalidRoute_ThrowException()
        {
            var request = new HttpRequestMessage(HttpMethod.Post, _dummyAddress + "/api/InvalidController/");

            var _actionSelector = new ControllerActionSelector(_config, request);

            Assert.Throws <HttpResponseException>(() => _actionSelector.GetActionName());
        }
예제 #2
0
        public void Route_Should_Post_Order_Action_IsInvoked()
        {
            // Arrange
            var request = new HttpRequestMessage(HttpMethod.Post, _dummyAddress + "api/orders/");

            // Act
            var _actionSelector = new ControllerActionSelector(_config, request);

            // Assert
            Assert.That(GetMethodName((OrdersController c) =>
                                      c.PostOrder(new Order())),
                        Is.EqualTo(_actionSelector.GetActionName()));
        }
예제 #3
0
        public void Route_Should_Controller_GetProductById_IsInvoked()
        {
            // Arrange
            var request = new HttpRequestMessage(HttpMethod.Get, _dummyAddress + "api/products/16");

            // Act
            var _actionSelector = new ControllerActionSelector(_config, request);

            // Assert
            Assert.That(typeof(ProductsController), Is.EqualTo(_actionSelector.GetControllerType()));
            Assert.That(GetMethodName((ProductsController c) =>
                                      c.GetById(16)),
                        Is.EqualTo(_actionSelector.GetActionName()));
        }