public ApplicationTests(ApplicationFixture fixture) { _fixture = fixture; _context = fixture.Context; _context.Add(CreateEmailTemplate()); _context.SaveChanges(); }
public ApplicationFixture() { Mediator = new Mock <IMediator>().Object; var mockAcc = new Mock <IHttpContextAccessor>(); mockAcc.Setup(x => x.HttpContext).Returns(new DefaultHttpContext()); Accessor = mockAcc.Object; Context = CreateDbContext(Mediator, Accessor); }
public CremaDbContext CreateDbContext(IMediator mediator = default, IHttpContextAccessor accessor = default) { var builder = new DbContextOptionsBuilder <CremaDbContext>(); builder.UseInMemoryDatabase(Guid.NewGuid().ToString()) .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); var options = builder.Options; var personDataContext = new CremaDbContext(options, mediator ?? Mediator, accessor ?? Accessor); personDataContext.Database.EnsureDeleted(); personDataContext.Database.EnsureCreated(); foreach (var e in personDataContext.ChangeTracker.Entries().ToList()) { e.State = EntityState.Detached; } return(personDataContext); }
public AuthorizationHandler(CremaDbContext context, IConfiguration configuration) { _context = context; _configuration = configuration; }
public UserHandler(CremaDbContext context, IHttpContextAccessor accessor) { _context = context; _accessor = accessor; }
public QueryableExtensionTest(ApplicationFixture fixture) { _context = fixture.Context; _context.Users.Add(new User("Test", "User", "*****@*****.**", "password", "5050000000")); _context.SaveChanges(); }
public EmailTemplateQuery(CremaDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public RoleQuery(CremaDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public ApplicationTests(ApplicationFixture fixture) { _fixture = fixture; _context = fixture.Context; }
public EmailTemplateHandler(CremaDbContext context) { _context = context; }