예제 #1
0
        public async void CanCreateBand()
        {
            using (var setup = new SQLiteInMemorySetup())
            {
                using (var context = new ConcertManagerContext(setup.ContextOptions))
                {
                    context.Database.EnsureCreated();
                }

                using (var context = new ConcertManagerContext(setup.ContextOptions))
                {
                    var service = new BandService(context);
                    await service.InsertBandAsync(new Band { Name = "Teszt", Country = "Magyarország", FormedIn = 2020 });
                }

                using (var context = new ConcertManagerContext(setup.ContextOptions))
                {
                    Assert.Equal(8, context.Bands.Count());
                    Assert.Equal("Teszt", context.Bands.Find(8).Name);
                }
            }
        }