Exemplo n.º 1
0
        public async void SaveRoomInDb()
        {
            // Arrange

            DbContextOptions <AsyncDbContext> options = new DbContextOptionsBuilder <AsyncDbContext>()
                                                        .UseInMemoryDatabase("SaveRoomInDb")
                                                        .Options;

            // Act

            using (AsyncDbContext context = new AsyncDbContext(options))
            {
                Room room = new Room();
                room.Name   = "Cloud Inn";
                room.Layout = Layout.Studio;

                context.Room.Add(room);
                await context.SaveChangesAsync();

                Room result = await context.Room.FirstOrDefaultAsync(x => x.Name == room.Name);

                Assert.Equal("Cloud Inn", result.Name);
            }
        }
Exemplo n.º 2
0
 public RoomService(AsyncDbContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public HotelService(AsyncDbContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
 public AmenitiesController(AsyncDbContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public AmenitiesService(AsyncDbContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public AmenitiesController(AsyncDbContext context, IAmenitiesManager amenities)
 {
     _context   = context;
     _amenities = amenities;
 }
Exemplo n.º 7
0
 public RoomsController(AsyncDbContext context)
 {
     _context = context;
 }