public async Task Should_return_422_storing_dodgy_director() { //Given RouteHandlers.CreateDirectorHandler = director => CreateDirectorRoute.Handle(director, newDirector => 1); //When var res = await this.client.PostAsync("/functional/directors", new StringContent(JsonConvert.SerializeObject(new Director { Name = "" }), Encoding.UTF8, "application/json")); //Then Assert.Equal(422, (int)res.StatusCode); }
public async Task Should_store_director() { //Given RouteHandlers.CreateDirectorHandler = director => CreateDirectorRoute.Handle(director, newDirector => 1); //When var res = await this.client.PostAsync("/functional/directors", new StringContent(JsonConvert.SerializeObject(new Director { Name = "Jon Favreau" }), Encoding.UTF8, "application/json")); //Then Assert.Equal(HttpStatusCode.Created, res.StatusCode); Assert.NotNull(res.Headers.Location); }