static void Main(string[] args) { #region FacadePattern //DbClient dbClient = new DbClient(); //dbClient.SelectAllHotels(); //Console.WriteLine(); //dbClient.SelectSpecificHotel(7); //Console.WriteLine(); //dbClient.Insert(9, "Fiskefars Bodel Hotel", "Fisketorvet 69, 4000 Roskilde"); //dbClient.SelectAllHotels(); //Console.WriteLine(); //dbClient.Delete(9); //dbClient.SelectAllHotels(); //dbClient.UpdateHotel(1, "The Pepe", "Pepestreet 420"); //dbClient.SelectAllHotels(); #endregion GuestController gController = new GuestController(); //gController.CreateGuest(new Guest() { GuestNr = 31, Navn = "Gunner Jensen", Adresse = "Gedevej 29, 4000 Roskilde" }); gController.DeleteGuest(31); Console.ReadLine(); }
public void DeleteGuestTest() { var id = Guid.Parse("0D4A6A72-1E8E-44B6-8E40-3E68D924F107"); Assert.IsNotNull(_context.Guest.Find(id), "The method returned null. the guest can't be found."); var guest = _context.Guest.Find(id); var deletedGuest = _GuestController.DeleteGuest(id).Value; Assert.IsNotNull(deletedGuest, "The method returned null. The deleted guest can't be found."); Assert.IsNull(_context.Guest.Find(id), "The method did not return null. It finds Guest in the database."); _context.Add(guest); _context.SaveChanges(); }