public void AddPilot_When_correct_data_Then_count_equal_1() { //assign PilotDTO pilot = new PilotDTO() { Name = "Yan", Surname = "Gorshkov", Birthday = new DateTime(1998, 8, 21), Experience = 5 }; //act pilotService.AddPilot(pilot); //assert Assert.That(Pilots.Count == 1); }
public JsonResult Post([FromBody] PilotDTO pilot) { try { return(Json(pilotService.AddPilot(pilot))); } catch (System.Exception ex) { HttpContext.Response.StatusCode = 400; return(Json(ex.Message)); } }