예제 #1
0
        public async Task Should_Not_Find_Promo()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new PromoServiceFactory().Create(context);

                FluentActions.Invoking(async() => await service.Destroy(new Guid()))
                .Should().Throw <PromoNotFoundException>();
            }
        }
예제 #2
0
        public async Task Should_Destroy()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new PromoServiceFactory().Create(context);

                var promo = await context.Promos.FirstAsync();

                promo.Should().NotBeNull();

                await service.Destroy(promo.Id);

                var check = await context.Promos.FirstOrDefaultAsync(x => x.Id == promo.Id);

                check.Should().BeNull();
            }
        }