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);
 }
Exemplo n.º 2
0
 public Booking(User client, DateTime startBookDate, DateTime endBookDate, decimal totalPrice, string comments)
 {
     this.Client = client;
     this.StartBookDate = startBookDate;
     this.EndBookDate = endBookDate;
     this.TotalPrice = totalPrice;
     this.Comments = comments;
 }
Exemplo n.º 3
0
 public Venue(string name, string address, string description, User owner)
 {
     this.Name = name;
     this.Address = address;
     this.Description = description;
     this.Owner = owner;
     this.Rooms = new HashSet<Room>();
 }
        public void Get_GetExistingItem_ShouldReturnItem()
        {
            var user = new User("plamena", "Password123", Roles.User);
            usersRepo.Add(user);

            var result = usersRepo.Get(1);

            Assert.AreEqual(user, result);
        }
 public Venue(string name, string address, string description, User owner)
 {
     //added this to properties and initialize list
     this.Name = name;
     this.Address = address;
     this.Description = description;
     this.Owner = owner;
     this.Rooms = new List<Room>();
 }
        public void TestGet_ItemPresent_ShouldReturnItemId()
        {
            var user = new User("Admin", "Admin123", Roles.VenueAdmin);
            this.repository.Add(new Venue("Venue1", "Sofiq", "nqma", user));
            this.repository.Add(new Venue("Venue2", "Sofiq", "nqma", user));
            this.repository.Add(new Venue("Venue3", "Sofiq", "nqma", user));

            var result = this.repository.Get(2);

            Assert.AreEqual(2, result.Id);
        }
 public Booking(User client, DateTime startBookDate, DateTime endBookDate, decimal totalPrice, string comments)
 {
     //change to constructor parametars
     if (endBookDate < startBookDate)
     {
         throw new ArgumentException("The date range is invalid.");
     }
     //client property set
     this.Client = client;
     this.StartBookDate = startBookDate;
     this.EndBookDate = endBookDate;
     this.TotalPrice = totalPrice;
     this.Comments = comments;
 }
        public void TestInit()
        {
            var dataMock = new Mock<IHotelBookingSystemData>();
            var venuesRepoMock = new Mock<IRepository<Venue>>();
            var roomsRepoMock = new Mock<IRepository<Room>>();
            this.user = new User("admin", "Password1233", Roles.VenueAdmin);
            this.venue = new Venue("hotel Dreams", "addres Dreams", "desc Dreams", user);

            venuesRepoMock.Setup(v => v.Get(It.IsAny<int>())).Returns(this.venue);

            dataMock.Setup(d => d.VenuesRepository).Returns(venuesRepoMock.Object);
            dataMock.Setup(d => d.RoomsRepository).Returns(roomsRepoMock.Object);

            this.mockedData = dataMock.Object;
        }
        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 VenuesController(IHotelBookingSystemData data, User user)
     : base(data, user)
 {
 }
 public AuthorizationFailedException(string message, User user)
     : base(message)
 {
     this.User = user;
 }
 public Logout(User user)
     : base(user)
 {
 }
 public MyProfile(User user)
     : base(user)
 {
 }
 public Login(User user)
     : base(user)
 {
 }
 public Register(User user)
     : base(user)
 {
 }
 protected Controller(IHotelBookingSystemData data, User user)
 {
     this.Data = data;
     this.CurrentUser = user;
 }