Пример #1
0
        public void CreateShouldMapCorrectAction()
        {
            var    newsRequestModel = TestObjectFactoryDataTransferModels.GetValidNewsRequestModel();
            string jsonContent      = JsonConvert.SerializeObject(newsRequestModel);

            MyWebApi
            .Routes()
            .ShouldMap(CREATE_PATH)
            .WithJsonContent(jsonContent)
            .And()
            .WithHttpMethod(HttpMethod.Post)
            .To <NewsController>(n => n.Create(newsRequestModel));
        }
Пример #2
0
        public void CreateShouldThrowExceptionWithRouteDoesNotExistWhenHttpMethodIsInvalid()
        {
            var    newsRequestModel = TestObjectFactoryDataTransferModels.GetValidNewsRequestModel();
            string jsonContent      = JsonConvert.SerializeObject(newsRequestModel);

            var invalidHttpMethod = HttpMethod.Get;

            MyWebApi
            .Routes()
            .ShouldMap(CREATE_PATH)
            .WithJsonContent(jsonContent)
            .And()
            .WithHttpMethod(invalidHttpMethod)
            .To <NewsController>(n => n.Create(newsRequestModel));
        }