Exemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            Initer.Init(@"Server=ADWA;Database=Hotel;Trusted_Connection=true");

            var clientData = new ClientData("test", "test", "test", "test");
            var client = new Client { ClientData = clientData };
            var repo = new ClientRepository();
            repo.Save(client);

            var features = new List<Feature>();
            features.Add(Feature.Bathroom);
            var room = new Room { Quality = RoomQuality.Average, Features = features, Type = RoomType.HotelRoom };
            room.SetCapacity(5);

            var roomRepo = new RoomRepository();
            roomRepo.Save(room);

            var features2 = new List<Feature>();
            features2.Add(Feature.Bathroom);
            features2.Add(Feature.Tv);
            var room2 = new Room { Quality = RoomQuality.Good, Features = features2, Type = RoomType.HotelRoom };
            room2.SetCapacity(2);

            roomRepo.Save(room2);

            var duration = new DayDuration(DateTime.Now, DateTime.Now.AddDays(1));
            var reservation = new Reservation(client, room, duration);
            var reservationRepo = new ReservationRepository();
            reservationRepo.Save(reservation);
        }
Exemplo n.º 2
0
 public void Cant_add_two_same_guests()
 {
     var duration = new DayDuration(new DateTime(2016, 2, 10), new DateTime(2016, 2, 11));
     var reservation = new Reservation(null, null, duration);
     var guestOne = new Guest("Test", "Test");
     var guestTwo = new Guest("Test", "Test");
     reservation.AddGuest(guestOne);
     reservation.Invoking(x => x.AddGuest(guestTwo)).ShouldThrow<InvalidOperationException>();
 }