Beispiel #1
0
 public LandmarkRunService(
     ILandmarkApiClient landmarkApi,
     IRunRepository runRepository,
     IScenarioResultRepository scenarioResultRepository,
     ILandmarkAutoBookPayloadProvider landmarkAutoBookPayloadProvider,
     IHubNotification <LandmarkRunStatusNotification> runStatusChangedNotifier,
     IHubNotification <InfoMessageNotification> infoMessageNotification,
     ILandmarkHttpPoliciesHolder policiesHolder,
     IAuditEventRepository auditEventRepository,
     IClock clock,
     IKPICalculationScopeFactory kpiCalculationScopeFactory,
     IMapper mapper)
 {
     _landmarkApi                     = landmarkApi;
     _runRepository                   = runRepository;
     _scenarioResultRepository        = scenarioResultRepository;
     _landmarkAutoBookPayloadProvider = landmarkAutoBookPayloadProvider;
     _runStatusChangedNotifier        = runStatusChangedNotifier;
     _infoMessageNotification         = infoMessageNotification;
     _policiesHolder                  = policiesHolder;
     _auditEventRepository            = auditEventRepository;
     _clock = clock;
     _kpiCalculationScopeFactory = kpiCalculationScopeFactory;
     _mapper = mapper;
 }
Beispiel #2
0
        public void Init()
        {
            _fixture = new Fixture();
            _mockHttpMessageHandler   = new Mock <HttpMessageHandler>();
            _mockAuditEventRepository = new Mock <IAuditEventRepository>();
            _httpClient        = new HttpClient(_mockHttpMessageHandler.Object);
            _landmarkApiClient = new LandmarkApiClient(_httpClient, _fixture.Create <LandmarkApiConfig>(), _mockAuditEventRepository.Object);

            _mockResponse = new HttpResponseMessage(HttpStatusCode.Accepted)
            {
                Content = new StringContent(JsonConvert.SerializeObject(_fixture.Create <Guid>()))
            };

            _ = _mockHttpMessageHandler.Protected()
                .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                ).ReturnsAsync(_mockResponse);
        }