public void Test(
            bool hasSymptom,
            string keyData,
            int rollingStartNumberDayOffset,
            int rollingPeriod,
            int transmissionRisk,
            int reportType,
            int daysSinceOnsetOfSymptoms,
            int infectiousFilterDaysSinceOnsetOfSymptomsFrom,
            int infectiousFilterDaysSinceOnsetOfSymptomsTo,
            int infectiousFilterDaysSinceTestFrom,
            int infectiousFilterDaysSinceTestTo,
            bool expectedResult
            )
        {
            // arrange
            var config = new Mock <IConfiguration>();

            config.Setup(x => x["InfectiousFilterDaysSinceOnsetOfSymptomsFrom"]).Returns($"{infectiousFilterDaysSinceOnsetOfSymptomsFrom}");
            config.Setup(x => x["InfectiousFilterDaysSinceOnsetOfSymptomsTo"]).Returns($"{infectiousFilterDaysSinceOnsetOfSymptomsTo}");
            config.Setup(x => x["InfectiousFilterDaysSinceTestFrom"]).Returns($"{infectiousFilterDaysSinceTestFrom}");
            config.Setup(x => x["InfectiousFilterDaysSinceTestTo"]).Returns($"{infectiousFilterDaysSinceTestTo}");

            var logger = new Mock.LoggerMock <TemporaryExposureKeyValidationService>();

            var service = new TemporaryExposureKeyValidationService(
                config.Object,
                logger
                );

            bool result = service.Validate(hasSymptom, new V3DiagnosisSubmissionParameter.Key()
            {
                KeyData                  = keyData,
                RollingStartNumber       = DateTime.UtcNow.Date.AddDays(rollingStartNumberDayOffset).ToRollingStartNumber(),
                RollingPeriod            = (uint)rollingPeriod,
                TransmissionRisk         = transmissionRisk,
                ReportType               = (uint)reportType,
                DaysSinceOnsetOfSymptoms = daysSinceOnsetOfSymptoms,
            });

            Assert.AreEqual(expectedResult, result);
        }
        public void Normal_Validate_NoHeader()
        {
            // arrange
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["InquiryLogApiKey"]).Returns("1234567890");

            var logger = new Mock.LoggerMock <ValidationInquiryLogService>();

            var context = new Mock <HttpContext>();

            context.Setup(_ => _.Request.Headers.ContainsKey("x-api-key")).Returns(false);

            // act
            var target = new ValidationInquiryLogService(logger, config.Object);
            var result = target.Validate(context.Object.Request);

            // assert
            Assert.AreEqual(IValidationInquiryLogService.ValidateResult.Error, result);
            Assert.IsFalse(result.IsValid);
            Assert.IsInstanceOfType(result.ErrorActionResult, typeof(BadRequestResult));
        }
        public void Normal_Validate()
        {
            // arrange
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["InquiryLogApiKey"]).Returns("1234567890");

            var logger = new Mock.LoggerMock <ValidationInquiryLogService>();

            var context = new Mock <HttpContext>();

            context.Setup(_ => _.Request.Headers["x-api-key"]).Returns("1234567890");
            context.Setup(_ => _.Request.Headers.ContainsKey("x-api-key")).Returns(true);

            // act
            var target = new ValidationInquiryLogService(logger, config.Object);
            var result = target.Validate(context.Object.Request);

            // assert
            Assert.AreEqual(IValidationInquiryLogService.ValidateResult.Success, result);
            Assert.IsTrue(result.IsValid);
            Assert.IsNull(result.ErrorActionResult);
        }
        public async Task GetAsyncMethod(string submissionNumber, string userUuid)
        {
            // preparation
            var model        = new DiagnosisModel();
            var itemResponse = new Mock <ItemResponse <DiagnosisModel> >();

            itemResponse.Setup(_ => _.Resource).Returns(model);
            var cosmos = new Mock <ICosmos>();

            cosmos.Setup(_ => _.Diagnosis.ReadItemAsync <DiagnosisModel>(It.IsAny <string>(),
                                                                         It.IsAny <PartitionKey>(),
                                                                         It.IsAny <ItemRequestOptions>(),
                                                                         It.IsAny <CancellationToken>()))
            .ReturnsAsync(itemResponse.Object)
            .Verifiable();
            var logger   = new Mock.LoggerMock <CosmosDiagnosisRepository>();
            var instance = new CosmosDiagnosisRepository(cosmos.Object, logger);
            // action
            var result = await instance.GetAsync(submissionNumber, userUuid);

            // Assert
            Assert.AreEqual(model, result);
        }