public async Task <ActionResult> Index(GetHealthCheckQuery query)
        {
            var response = await _mediator.SendAsync(query);

            var model = _mapper.Map <HealthCheckViewModel>(response);

            return(View(model));
        }
        public Task <ActionResult> Index()
        {
            GetHealthCheckQuery = new GetHealthCheckQuery();

            GetHealthCheckQueryResponse = new GetHealthCheckQueryResponse
            {
                HealthCheck = new HealthCheckDto()
            };

            Mediator.Setup(m => m.SendAsync(GetHealthCheckQuery)).ReturnsAsync(GetHealthCheckQueryResponse);

            return(HealthCheckController.Index(GetHealthCheckQuery));
        }
        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);
        }
Beispiel #4
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);
        }