public void TestInit() { data = new HotelBookingSystemData(); admin = new User("administrator", "Password123", Roles.VenueAdmin); user = new User("newUser", "Password123", Roles.User); venuesController = new VenuesController(data, admin); }
public void TestAuthorize_NoSufficientRights_ShouldThrow() { var db = new HotelBookingSystemData(); var controller = new VenuesController(db, new User("Pesho", "123456", Roles.User)); controller.Add("Test", "Sofiq", "no description"); }
public void TestAuthorize_ValidUser_ShouldPass() { var db = new HotelBookingSystemData(); var controller = new VenuesController(db, new User("Pesho", "1234567", Roles.VenueAdmin)); controller.Add("Test123", "Sofiq city", "no description"); }
public void TestAuthorize_NoLoggedUser_ShouldThrow() { var db = new HotelBookingSystemData(); var controller = new VenuesController(db, null); controller.Details(1); }
static void Main() { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; var data = new HotelBookingSystemData(); var reader = new ConsoleReader(); var writer = new ConsoleWriter(); var engine = new Engine(data, reader, writer); engine.Run(); }
public void TestAllVenues_WithoutVenues_CorrectReturnString() { const string expected = "There are currently no venues to show."; var db = new HotelBookingSystemData(); var controller = new VenuesController(db, null); var result = controller.All().Display(); Assert.AreEqual(expected, result); }
public static void Main() { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; var database = new HotelBookingSystemData(); var reader = new ConsoleInputReader(); var writer = new ConsoleOutputWriter(); var engine = new Engine(database, reader, writer); engine.StartOperation(); }
public void TestAllVenues_WithVenues_CorrectReturnString() { var resultString = new StringBuilder(); resultString.AppendLine("*[1] New venue, located at Sofia"); resultString.AppendLine("Free rooms: 0"); resultString.AppendLine("*[2] New venue 2, located at Sofia"); resultString.Append("Free rooms: 0"); var db = new HotelBookingSystemData(); var user = new User("Pesho", "1234567", Roles.VenueAdmin); var controller = new VenuesController(db, user); controller.Add("New venue", "Sofia", ""); controller.Add("New venue 2", "Sofia", ""); var result = controller.All().Display(); Assert.AreEqual(resultString.ToString(), result); }
public void TestLogout_WithoutLoggedUser_ShouldThrow() { var db = new HotelBookingSystemData(); var controller = new UsersController(db, null); controller.Logout(); }
public void TestLogout_WithLoggedUser_CurrentUserIsNull() { var db = new HotelBookingSystemData(); var controller = new UsersController(db, null); controller.Logout(); var user = controller.CurrentUser; Assert.IsNull(user); }