Example #1
0
        public void CanGetRoom()
        {
            DbContextOptions <AsyncdbContext> options = new DbContextOptionsBuilder <AsyncdbContext>().UseInMemoryDatabase("CanCreateHotel").Options;

            using (AsyncdbContext context = new AsyncdbContext(options))
            {
                Room      room      = new Room();
                HotelRoom hotelroom = new HotelRoom();

                room.HotelRoom     = hotelroom;
                room.ID            = 1;
                room.Name          = "Awesomeness";
                room.RoomAmenities = new RoomAmenities();
                room.RoomLayout    = 0;



                context.Add(hotelroom);
                context.SaveChanges();

                var result = context.Room.FirstOrDefault(m => m.ID == room.ID);

                Assert.NotEqual(result, room);
            }
        }
Example #2
0
        public void CanGetHotelRoom()
        {
            DbContextOptions <AsyncdbContext> options = new DbContextOptionsBuilder <AsyncdbContext>().UseInMemoryDatabase("CanCreateHotel").Options;

            using (AsyncdbContext context = new AsyncdbContext(options))
            {
                HotelRoom hotelroom = new HotelRoom();
                Hotel     hotel     = new Hotel();
                Room      room      = new Room();

                hotelroom.Hotel       = hotel;
                hotelroom.HotelID     = 1;
                hotelroom.PetFriendly = true;
                hotelroom.Rate        = 1200;
                hotelroom.Room        = room;
                hotelroom.RoomID      = 12;
                hotelroom.RoomNumber  = 001;


                context.Add(hotelroom);
                context.SaveChanges();

                var result = context.HotelRoom.FirstOrDefault(m => m.Hotel.ID == hotelroom.HotelID);

                Assert.Equal(result, hotelroom);
            }
        }
Example #3
0
        public void CanGetAmenitie()
        {
            DbContextOptions <AsyncdbContext> options = new DbContextOptionsBuilder <AsyncdbContext>().UseInMemoryDatabase("CanCreateHotel").Options;

            using (AsyncdbContext context = new AsyncdbContext(options))
            {
                Amenities amenities = new Amenities();

                amenities.Name          = "Heat";
                amenities.ID            = 1;
                amenities.RoomAmenities = new RoomAmenities();



                context.Add(amenities);
                context.SaveChanges();

                var result = context.Amenities.FirstOrDefault(m => m.ID == amenities.ID);

                Assert.Equal(result, amenities);
            }
        }
Example #4
0
        public void CanGetHotel()
        {
            DbContextOptions <AsyncdbContext> options = new DbContextOptionsBuilder <AsyncdbContext>().UseInMemoryDatabase("CanCreateHotel").Options;

            using (AsyncdbContext context = new AsyncdbContext(options))
            {
                Hotel hotel = new Hotel();


                hotel.ID           = 566;
                hotel.Name         = "Hotel Name";
                hotel.StreetAdress = "1234 N Address";
                hotel.State        = "Alabama";
                hotel.Phone        = 1234567;

                context.Add(hotel);
                context.SaveChanges();

                var result = context.Hotel.FirstOrDefault(m => m.ID == hotel.ID);

                Assert.Equal(result, hotel);
            }
        }
Example #5
0
        //[Fact]
        public void CanGetRoomAmenities()
        {
            DbContextOptions <AsyncdbContext> options = new DbContextOptionsBuilder <AsyncdbContext>().UseInMemoryDatabase("CanCreateHotel").Options;

            using (AsyncdbContext context = new AsyncdbContext(options))
            {
                RoomAmenities roomamenities = new RoomAmenities();

                roomamenities.Amenities   = new Amenities();
                roomamenities.AmenitiesID = 1;
                roomamenities.Room        = new Room();
                roomamenities.RoomID      = 1;



                context.Add(roomamenities);
                context.SaveChanges();

                var result = context.HotelRoom.FirstOrDefault(m => m.Hotel.ID == roomamenities.RoomID);

                //Assert.NotEqual(result, roomamenities);
            }
        }