public void DeletingHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Sasha", Logic.DTOs.UserType.Manager, "Veklych", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("Verkhovina", 3, "Khust, Zhayvoronkova 44/2")); Assert.That(HotelLogic.GetAllHotels().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Name == "Verkhovina"); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Stars == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Address == "Khust, Zhayvoronkova 44/2"); HotelLogic.DeleteHotel(1); Assert.That(HotelLogic.GetAllHotels().Count() == 0); Assert.That(UoW.Object.HotelsRooms.GetAll().Count == 0); }
public void DeletingHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Dimon", Logic.DTOs.UserType.Manager, "Cherneckii", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("auiwhe", 3, "auiwhe--, petuch 44/2")); Assert.That(HotelLogic.GetAllHotels().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Name == "auiwhe"); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Stars == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Address == "auiwhe--, petuch 44/2"); HotelLogic.DeleteHotel(1); Assert.That(HotelLogic.GetAllHotels().Count() == 0); Assert.That(UoW.Object.HotelsRooms.GetAll().Count == 0); }