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

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

            var service = new PaymentsService(dbContext);

            var paymentEdited = new PaymentsEditViewModel
            {
                Date          = DateTime.UtcNow.Date.AddDays(10),
                PaymentSource = "каса",
                Value         = 1000
            };

            await service.CreateAsync(payment);

            var result = service.EditAsync(paymentEdited);

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