Beispiel #1
0
        public async void CanEdiAmenity()
        {
            /// Can edit an existing amenity
            DbContextOptions <AsyncInnDbContext> options = new DbContextOptionsBuilder <AsyncInnDbContext>().UseInMemoryDatabase("UpdateAemnity").Options;

            using (AsyncInnDbContext context = new AsyncInnDbContext(options))
            {
                Amenities amen = new Amenities();
                amen.ID   = 72;
                amen.Name = "Poker";

                AmenitiesManagementServices amenServices = new AmenitiesManagementServices(context);
                await amenServices.CreateAmenity(amen);

                Amenities upAmen = await amenServices.GetAmenities(amen.ID);

                upAmen.Name = "Black-jack";

                await amenServices.UpdateAmenity(upAmen);

                var result = context.Amenities.FirstOrDefault(ho => ho.ID == amen.ID);

                Assert.Equal("Black-jack", result.Name);
            }
        }
Beispiel #2
0
        public async void CanCreateAmenity()
        {
            /// Can create a new amenity
            DbContextOptions <AsyncInnDbContext> options = new DbContextOptionsBuilder <AsyncInnDbContext>().UseInMemoryDatabase("CreateAemnity").Options;

            using (AsyncInnDbContext context = new AsyncInnDbContext(options))
            {
                Amenities amen = new Amenities();
                amen.ID   = 72;
                amen.Name = "Poker";

                AmenitiesManagementServices amenServices = new AmenitiesManagementServices(context);
                await amenServices.CreateAmenity(amen);

                var result = context.Amenities.FirstOrDefault(ho => ho.ID == amen.ID);

                Assert.Equal(amen, result);
            }
        }