public void PostsLocation() { var vehicleModelController = new VehicleModelsController(vehicleServiceModel.Object, _vehicleServiceMake, _mapper); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/"); IHttpRoute route = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}"); HttpRouteData routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "posts" } }); vehicleModelController.ControllerContext = new HttpControllerContext(config, routeData, request); request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; request.Properties[HttpPropertyKeys.HttpRouteDataKey] = routeData; vehicleModelController.Request = request; VehicleModel vehicleModel = new VehicleModel() { Id = modelId }; vehicleServiceModel.Should().Equals(HttpStatusCode.Created); vehicleServiceModel.Should().NotBeNull(); }
public async Task GetById() { var vehicleModelController = new VehicleModelsController(vehicleServiceModel.Object, _vehicleServiceMake, _mapper); await vehicleModelController.GetVehicleModel(modelId); vehicleServiceModel.Should().NotBeNull(); vehicleServiceModel.Should().Equals(modelId); }