public static TyreKlickerDbContext Create() { var options = new DbContextOptionsBuilder <TyreKlickerDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new TyreKlickerDbContext(options); context.Database.EnsureCreated(); var user = new Domain.Entities.User { Id = Guid.Parse("2220d661-6a96-4537-a896-5014374d39f5"), Email = "*****@*****.**", FirstName = "Ryan", LastName = "Stuart" }; context.User.Add(user); context.Address.AddRange(new Domain.Entities.Address { City = "SEDGWICK", PrimaryAddress = true, PhoneNumber = "070 1639 2540", Postcode = "LA8 4HA", Street = "HOPE STREET", User = user }); SeedOrders(context); context.SaveChanges(); return(context); }
public CompleteOrderTestFixtures(QueryTestFixture fixture) { Context = fixture.Context; Order = new Domain.Entities.Order() { Id = Guid.NewGuid(), AcceptedByUserId = Guid.NewGuid(), Complete = false }; Context.Order.Add(Order); Context.SaveChanges(); }
private static void SeedOrders(TyreKlickerDbContext context) { var orders = new[] { new Domain.Entities.Order() { Id = Guid.Parse("f0470dc0-9f14-4152-8b81-82235a85edf7"), Description = "I have been accepted", Registration = "MW09 OEJ", AcceptedByUserId = Guid.Parse("75a1e4c8-65d7-4f70-b8e8-216543e7462b"), } }; context.Order.AddRange(orders); context.SaveChanges(); }
public AcceptOrderTestsFixture(QueryTestFixture fixture) { Context = fixture.Context; AcceptedOrder = new Domain.Entities.Order() { Id = Guid.NewGuid(), AcceptedByUserId = Guid.NewGuid() }; PendingOrder = new Domain.Entities.Order() { Id = Guid.NewGuid(), }; Context.Order.Add(AcceptedOrder); Context.Order.Add(PendingOrder); Context.SaveChanges(); }
public TyreKlickerDbContext GetDbContext(bool useSqlLite = false) { var builder = new DbContextOptionsBuilder <TyreKlickerDbContext>(); builder.UseInMemoryDatabase(Guid.NewGuid().ToString()); var dbContext = new TyreKlickerDbContext(builder.Options); if (useSqlLite) { // SQLite needs to open connection to the DB. // Not required for in-memory-database. dbContext.Database.OpenConnection(); } dbContext.Database.EnsureCreated(); return(dbContext); }
public GetOrderQueryHandler(TyreKlickerDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public static void Destroy(TyreKlickerDbContext context) { context.Database.EnsureDeleted(); context.Dispose(); }
public CompleteOrderCommandHandler(TyreKlickerDbContext context) { _context = context; }
public GetAllOrdersCreatedByUserQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; }
public GetUserByIdQueryHandler(TyreKlickerDbContext context) { _context = context; }
public CreatePaymentCommandHandler(TyreKlickerDbContext context, IPaymentService paymentService) { _context = context; _paymentService = paymentService; }
public GetOrderQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; }
public GetCurrentOrdersQueryHandler(TyreKlickerDbContext context) { _context = context; }
public GetAddressesQueryHandler(TyreKlickerDbContext context) { _context = context; }
public GetAllOrdersQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; }
public GetAllPendingOrdersQueryHandler(TyreKlickerDbContext context) { _context = context; }
public CreateAddressCommandHandler(TyreKlickerDbContext context) { _context = context; }
public GetAllOrdersAcceptedByUserQueryHandler(TyreKlickerDbContext context) { _context = context; }
public CreateUserCommandValidatorTests(QueryTestFixture fixture) { _context = fixture.Context; _validator = new CreateUserCommandValidator(); }
public AcceptOrderCommandHandler(TyreKlickerDbContext context) { _context = context; }
public QueryTestFixture() { Context = TyreKlickerContextFactory.Create(); Mapper = AutoMapperFactory.Create(); }
public CreateOrderCommandHandler(TyreKlickerDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public SetPrimaryAddressCommandHandler(TyreKlickerDbContext context) { _context = context; }
public CreateUserCommandHandler(TyreKlickerDbContext context) { _context = context; }
public GetPrimaryAddressQueryHandler(TyreKlickerDbContext context) { _context = context; }
public GetAllOrdersCreatedUserQueryHandler(TyreKlickerDbContext context) { _context = context; }