public async Task RepoUpdateAirportTest() { DbContextOptions <SWTDbContext> options = new DbContextOptionsBuilder <SWTDbContext>() .UseInMemoryDatabase("UpdateAirport") .Options; using SWTDbContext testContext = new SWTDbContext(options); Repo repo = new Repo(testContext); Logic.Airport newAirport = new Logic.Airport { Name = "DFW", Location = "Dallas", Weather = "Cloudy" }; string create = await repo.CreateAirport(airport); string update = await repo.UpdateAirport(newAirport); string location = testContext.Airport.Select(a => a.Location).First(); string weather = testContext.Airport.Select(a => a.Weather).First(); Assert.Equal(newAirport.Location, location); Assert.Equal(newAirport.Weather, weather); }
//Map Business --> Entity public static Airport MapAirportToE(Logic.Airport BAirport) { return(new Airport { Name = BAirport.Name, Location = BAirport.Location, Weather = BAirport.Weather, }); }
public void AirportTest() { Logic.Airport airport1 = new Logic.Airport { Name = "Sweentened", Location = "Dallas", Weather = "Sunny" }; Logic.Airport airport2 = new Logic.Airport(1, "Sweentened", "Dallas", "Sunny"); Assert.Equal(airport1.Name, airport2.Name); Assert.Equal(airport1.Location, airport2.Location); Assert.Equal(airport1.Weather, airport2.Weather); }