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 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 Authorize_VenuesDetailsNonAuthorizedUser_ShouldThrow() { data.VenuesRepository.Add(new Venue("hotel", "Borovo 456", null, null)); var controller = new VenuesController(data, user); controller.Add("hotel Mirage", "Borovo 456", null); }