public GetHealthCheckQueryHandlerTestsFixture()
        {
            GetHealthCheckQuery = new GetHealthCheckQuery();
            Db = new Mock <EmployerFinanceDbContext>();
            ConfigurationProvider = new MapperConfiguration(c => c.AddProfile <HealthCheckMappings>());

            HealthChecks = new List <HealthCheck>
            {
                new HealthCheckBuilder().WithId(1).Build(),
                new HealthCheckBuilder().WithId(2).Build()
            };

            Db.Setup(d => d.HealthChecks).Returns(new DbSetStub <HealthCheck>(HealthChecks));

            Handler = new GetHealthCheckQueryHandler(new Lazy <EmployerFinanceDbContext>(() => Db.Object), ConfigurationProvider);
        }
コード例 #2
0
        public GetHealthCheckQueryHandlerTestsFixture()
        {
            GetHealthCheckQuery = new GetHealthCheckQuery();
            Db = new ProviderRelationshipsDbContext(new DbContextOptionsBuilder <ProviderRelationshipsDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)).Options);
            ConfigurationProvider = new MapperConfiguration(c => c.AddProfiles(typeof(HealthCheckMappings)));

            HealthChecks = new List <HealthCheck>
            {
                EntityActivator.CreateInstance <HealthCheck>().Set(h => h.Id, 1),
                EntityActivator.CreateInstance <HealthCheck>().Set(h => h.Id, 2)
            };

            Db.HealthChecks.AddRange(HealthChecks);
            Db.SaveChanges();

            Handler = new GetHealthCheckQueryHandler(new Lazy <ProviderRelationshipsDbContext>(() => Db), ConfigurationProvider);
        }