예제 #1
0
        public async Task PaymentDeleteTest()
        {
            var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                .UseInMemoryDatabase("testDb");
            var dbContext = new ApplicationDbContext(optionBuilder.Options);
            var service   = new PaymentsService(dbContext);

            var payment = new PaymentsInputViewModel
            {
                Date          = DateTime.UtcNow.Date,
                PaymentSource = "каса",
                Value         = 100
            };
            await service.CreateAsync(payment);

            var result = service.DeleteAsync(1);

            Assert.True(result.IsCompletedSuccessfully);
            Assert.NotNull(result);
            Assert.Null(result.Exception);
        }