public async Task PostALonganizaShouldReturSuccess() { using (var server = TestServer.Create<TestStartup>()) { var longanizaCatalana = new Longaniza { Name = "catalana", Price = 20, SelledBy = new List<Shop> { new Shop { Id = 6, Name = "Carniceria pepa" } } }; HttpResponseMessage response = await server.HttpClient .PostAsync<Longaniza>("api/longanizas", longanizaCatalana, new JsonMediaTypeFormatter()); response.IsSuccessStatusCode.Should().BeTrue(); } }
public IHttpActionResult AddLonganiza(Longaniza newLonganiza) { return Ok(); }