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)); }
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)); }