public async Task <IActionResult> PostAsync(AircraftPostOptions options) { _aircraftManager.Post(options); await _aircraftManager.SaveChangesAsync(); return(RedirectToAction("GetPage")); }
public AircraftModel SeedAircraft(AircraftPostOptions options) { var model = AircraftManager.Post(options); AircraftManager.SaveChanges(); return(model); }
public AircraftModel Post(AircraftPostOptions options) { var model = new AircraftModel { Number = options.Number, ConsumptionPerKm = options.ConsumptionPerKm, TakeOffEffort = options.TakeOffEffort, }; Context.Aircrafts.Add(model); return(model); }
public async Task Should_Get_One_Then_Zero_Aircraft() { _fixture.EmptyDatabase(); var options = new AircraftPostOptions { Number = "0001", }; var model = _fixture.AircraftManager.Post(options); _fixture.AircraftManager.SaveChanges(); Assert.Equal(1, _fixture.AircraftManager.GetPage().Data.Count()); await _fixture.AircraftManager.DeleteAsync(model.PublicId); _fixture.AircraftManager.SaveChanges(); Assert.Equal(0, _fixture.AircraftManager.GetPage().Data.Count()); }
public void Should_Get_One_Then_Three_Aircrafts() { _fixture.EmptyDatabase(); var options = new AircraftPostOptions { Number = "0001", }; _fixture.AircraftManager.Post(options); _fixture.AircraftManager.SaveChanges(); Assert.Equal(1, _fixture.AircraftManager.GetPage().Data.Count()); options.Number = "0002"; _fixture.AircraftManager.Post(options); options.Number = "0003"; _fixture.AircraftManager.Post(options); _fixture.AircraftManager.SaveChanges(); Assert.Equal(3, _fixture.AircraftManager.GetPage().Data.Count()); }