private void InitContext() { var builder = new DbContextOptionsBuilder <MoulaContext>(); var context = new MoulaContext(builder.Options); _unitOfWork = new UnitOfWork(context); }
public static void InitDatabaseForTest(MoulaContext context) { context.Customers.Add(new Customer { Balance = 50000, Id = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Name = "John Doe" }); context.Payments.AddRange(new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Closed, Id = Guid.Parse("debf1d88-47ac-4fe4-a0b0-ce42f72ea66e") }, new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Pending, Id = Guid.Parse("b162e88d-a3a6-4341-87da-725658d743f3") }, new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Processed, Id = Guid.Parse("154f10e0-85be-4da7-9499-b05dbcc40b92") }); context.SaveChanges(); }
public void Init() { _mediator = new Mock <IMediator>(); _mediator .Setup(m => m.Send(It.IsAny <GetCustomerQuery>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(new CustomerVm { Balance = 50000 })); _context = MoulaContextFactory.Create(); }
public void Init() { _context = MoulaContextFactory.Create(); _mediator = new Mock <IMediator>(); _mediator.Setup(m => m.Send(It.IsAny <GetCustomerQuery>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(new CustomerVm { Id = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d") })); }
public static MoulaContext Create() { var options = new DbContextOptionsBuilder <MoulaContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new MoulaContext(options); context.Database.EnsureCreated(); context.Customers.Add(new Customer { Balance = 50000, Id = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Name = "John Doe" }); context.Payments.AddRange(new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Closed, Id = Guid.Parse("debf1d88-47ac-4fe4-a0b0-ce42f72ea66e") }, new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Pending, Id = Guid.Parse("b162e88d-a3a6-4341-87da-725658d743f3") }, new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Pending, Id = Guid.Parse("b162e88d-a3a6-4341-87da-725658d744f3") }, new Payment { Amount = 100, CustomerId = Guid.Parse("39aff1c2-5530-4112-bd3d-b72b52f4d69d"), Date = DateTime.Now, Status = PaymentStatus.Processed, Id = Guid.Parse("154f10e0-85be-4da7-9499-b05dbcc40b92") }); context.SaveChanges(); return(context); }
public TransactionRepository(MoulaContext context) : base(context) { }
public PaymentRequestRepository(MoulaContext context) : base(context) { }
public void Init() { _mediator = new Mock <IMediator>(); _context = MoulaContextFactory.Create(); }
public static void Destroy(MoulaContext context) { context.Database.EnsureDeleted(); context.Dispose(); }
public void Init() { _context = MoulaContextFactory.Create(); }