public static NonProfitContext Create()
        {
            var options = new DbContextOptionsBuilder <NonProfitContext>()
                          .UseSqlite(TestSetting.ConnectionString)
                          .Options;

            var context = new NonProfitContext(options);

            context.Database.OpenConnection();
            context.Database.EnsureCreated();

            context.Events.AddRange(new[] {
                new Event {
                    Id = 1, Name = "TestEvent1", StartDateTime = DateTime.Now, EndDateTime = DateTime.Now
                },
                new Event {
                    Id = 2, Name = "TestEvent1", StartDateTime = DateTime.Now, EndDateTime = DateTime.Now
                },
            });

            context.SaveChanges();

            return(context);
        }
 public DonationsController(NonProfitContext db)
 {
     _db = db;
 }
 public TestFixture()
 {
     Context = NonProfitContextFactory.Create();
 }
 public CreateEventCommandHandler(NonProfitContext context)
 {
     _context = context;
 }
Ejemplo n.º 5
0
 public GetEventDetailQueryTests(TestFixture fixture)
 {
     _context = fixture.Context;
 }
 public DonorsController(NonProfitContext db)
 {
     _db = db;
 }
 public CreateEventCommandTests(TestFixture fixture)
 {
     _context = fixture.Context;
 }
 public static void Destroy(NonProfitContext context)
 {
     context.Database.EnsureDeleted();
     context.Dispose();
 }
 public GetEventDetailQueryHandler(NonProfitContext context)
 {
     _context = context;
 }