Пример #1
0
        public void CreateMethod()
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["SupportRegions"]).Returns("Region1,Region2");
            var diagnosisRepo = new Mock <IDiagnosisRepository>();
            var tekRepo       = new Mock <ITemporaryExposureKeyRepository>();
            var validation    = new Mock <IValidationUserService>();
            var deviceCheck   = new Mock <IDeviceValidationService>();
            var logger        = new Mock.LoggerMock <Covid19Radar.Api.DiagnosisApi>();
            var diagnosisApi  = new DiagnosisApi(config.Object,
                                                 diagnosisRepo.Object,
                                                 tekRepo.Object,
                                                 validation.Object,
                                                 deviceCheck.Object,
                                                 logger);
        }
        public async Task RunAsyncMethodWithNull()
        {
            // preparation
            var config        = new Mock <IConfiguration>();
            var tekExportRepo = new Mock <ITemporaryExposureKeyExportRepository>();
            var resultModels  = new List <TemporaryExposureKeyExportModel>();

            tekExportRepo.Setup(_ => _.GetKeysAsync(It.IsAny <ulong>())).ReturnsAsync(resultModels.ToArray());
            var logger = new Mock.LoggerMock <TemporaryExposureKeysApi>();
            var temporaryExposureKeysApi = new TemporaryExposureKeysApi(config.Object, tekExportRepo.Object, logger);
            var context = new Mock <HttpContext>();

            context.Setup(_ => _.Request.Query).Returns <IQueryCollection>(null);
            // action
            await temporaryExposureKeysApi.RunAsync(context.Object.Request);

            // assert
        }
Пример #3
0
        public async Task RunAsyncMethod(bool isValid, string submissionNumber, string userUuid)
        {
            // preparation
            var diagnosisRepo = new Mock <IDiagnosisRepository>();

            diagnosisRepo.Setup(_ => _.SubmitDiagnosisAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <TemporaryExposureKeyModel[]>()))
            .Returns(Task.CompletedTask);
            var validation       = new Mock <IValidationUserService>();
            var validationResult = new IValidationUserService.ValidateResult()
            {
                IsValid = isValid
            };

            validation.Setup(_ => _.ValidateAsync(It.IsAny <HttpRequest>(), It.IsAny <IUser>())).ReturnsAsync(validationResult);
            var logger       = new Mock.LoggerMock <Covid19Radar.Api.DiagnosisApi>();
            var diagnosisApi = new Covid19Radar.Api.DiagnosisApi(diagnosisRepo.Object, validation.Object, logger);
            var context      = new Mock.HttpContextMock();
            var bodyJson     = new DiagnosisSubmissionParameter()
            {
                SubmissionNumber = submissionNumber,
                UserUuid         = userUuid,
                Keys             = new DiagnosisSubmissionParameter.Key[] {
                    new DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = "", RollingPeriod = 1, RollingStartNumber = 1
                    }
                }
            };
            var bodyString = Newtonsoft.Json.JsonConvert.SerializeObject(bodyJson);

            using var stream = new System.IO.MemoryStream();
            using (var writer = new System.IO.StreamWriter(stream, leaveOpen: true))
            {
                await writer.WriteAsync(bodyString);

                await writer.FlushAsync();
            }
            stream.Seek(0, System.IO.SeekOrigin.Begin);
            context._Request.Body = stream;
            // action
            await diagnosisApi.RunAsync(context.Request);

            // assert
        }
Пример #4
0
        public async Task RunAsyncMethod(bool isValid, string userUuid)
        {
            // preparation
            var notification     = new Mock.NotificationServiceMock();
            var validation       = new Mock <IValidationUserService>();
            var validationResult = new IValidationUserService.ValidateResult()
            {
                IsValid = isValid
            };

            validation.Setup(_ => _.ValidateAsync(It.IsAny <HttpRequest>(), It.IsAny <IUser>())).ReturnsAsync(validationResult);
            var logger  = new Mock.LoggerMock <UserApi>();
            var userApi = new UserApi(notification, validation.Object, logger);
            var context = new Mock.HttpContextMock();
            // action
            await userApi.RunAsync(context.Request, userUuid);

            // assert
        }
Пример #5
0
        public async Task RunAsyncMethodOnErrorValidationServer()
        {
            // preparation
            var userRepo         = new Mock <IUserRepository>();
            var validationServer = new Mock <IValidationServerService>();

            validationServer.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationServerService.ValidateResult.Error);

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

            var registerApi = new RegisterApi(userRepo.Object, validationServer.Object, logger);
            var context     = new Mock <HttpContext>();

            // action
            var result = await registerApi.RunAsync(context.Object.Request);

            // assert
            Assert.AreEqual(IValidationServerService.ValidateResult.Error.ErrorActionResult, result);
        }
Пример #6
0
        public async Task RunAsyncMethod(string userUuid, bool isValid)
        {
            // preparation
            var userRepo         = new Mock <IUserRepository>();
            var diagnosisRepo    = new Mock <IDiagnosisRepository>();
            var validation       = new Mock <IValidationUserService>();
            var validationResult = new IValidationUserService.ValidateResult()
            {
                IsValid = isValid
            };

            validation.Setup(_ => _.ValidateAsync(It.IsAny <HttpRequest>(), It.IsAny <IUser>())).ReturnsAsync(validationResult);
            var logger    = new Mock.LoggerMock <OptOutApi>();
            var optOutApi = new OptOutApi(userRepo.Object, diagnosisRepo.Object, validation.Object, logger);
            var context   = new Mock <HttpContext>();
            // action
            await optOutApi.RunAsync(context.Object.Request, userUuid);

            // assert
        }
Пример #7
0
        public void Exception_Run_InquiryLogValidationError()
        {
            // arrange
            var logger = new Mock.LoggerMock <InquiryLogApi>();
            var inquiryLogBlobService = new Mock <IInquiryLogBlobService>();

            inquiryLogBlobService.Setup(_ => _.GetServiceSASToken()).Returns("1234567890");
            var validationServer = new Mock <IValidationServerService>();

            validationServer.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationServerService.ValidateResult.Success);
            var validationInquiryLog = new Mock <IValidationInquiryLogService>();

            validationInquiryLog.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationInquiryLogService.ValidateResult.Error);
            var context = new Mock <HttpContext>();

            // act
            var target = new InquiryLogApi(logger, inquiryLogBlobService.Object, validationServer.Object, validationInquiryLog.Object);
            var result = target.Run(context.Object.Request);

            // assert
            Assert.IsInstanceOfType(result, typeof(BadRequestResult));
        }
Пример #8
0
        public void CreateMethod()
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["SupportRegions"]).Returns("Region1,Region2");
            var tekRepo          = new Mock <ITemporaryExposureKeyRepository>();
            var validationServer = new Mock <IValidationServerService>();
            var deviceCheck      = new Mock <IDeviceValidationService>();
            var verification     = new Mock <IVerificationService>();
            var temporaryExposureKeyValidationService = new Mock <ITemporaryExposureKeyValidationService>();
            var logger       = new Mock.LoggerMock <V3DiagnosisApi>();
            var diagnosisApi = new V3DiagnosisApi(config.Object,
                                                  tekRepo.Object,
                                                  deviceCheck.Object,
                                                  verification.Object,
                                                  validationServer.Object,
                                                  temporaryExposureKeyValidationService.Object,
                                                  logger);

            // assert
            Assert.IsNotNull(diagnosisApi);
        }
Пример #9
0
        public async Task RunAsyncMethod(
            bool isValidRoute,
            bool isValidDevice,
            string contentLength,
            string jsonFileName,
            int expectedStatusCode,
            int expectedSavedItemCount
            )
        {
            // preparation
            var eventLogRepository      = new Mock <IEventLogRepository>();
            var validationServer        = new Mock <IValidationServerService>();
            var deviceValidationService = new Mock <IDeviceValidationService>();
            var logger = new Mock.LoggerMock <V1EventLog>();

            var eventLogApi = new V1EventLog(
                eventLogRepository.Object,
                validationServer.Object,
                deviceValidationService.Object,
                logger
                );

            if (isValidRoute)
            {
                validationServer
                .Setup(x => x.Validate(It.IsAny <HttpRequest>()))
                .Returns(IValidationServerService.ValidateResult.Success);
            }
            else
            {
                validationServer
                .Setup(x => x.Validate(It.IsAny <HttpRequest>()))
                .Returns(IValidationServerService.ValidateResult.InvalidAzureFrontDoorId);
            }

            deviceValidationService
            .Setup(x => x.Validation(It.IsAny <string>(), It.IsAny <IDeviceVerification>(), It.IsAny <DateTimeOffset>()))
            .ReturnsAsync(isValidDevice);


            var context = new Mock <HttpContext>();

            // Conetnt-Length header
            context.Setup(_ => _.Request.Headers).Returns(new HeaderDictionary());
            if (contentLength != null)
            {
                IHeaderDictionary headers = new HeaderDictionary()
                {
                    { "Content-Length", contentLength }
                };
                context.Setup(_ => _.Request.Headers).Returns(headers);
            }

            // body
            string bodyString = GetTestJson(jsonFileName);

            using var stream = new MemoryStream();
            using (var writer = new StreamWriter(stream, leaveOpen: true))
            {
                await writer.WriteAsync(bodyString);

                await writer.FlushAsync();
            }
            stream.Seek(0, SeekOrigin.Begin);
            context.Setup(x => x.Request.Body).Returns(stream);

            // action
            var result = await eventLogApi.RunAsync(context.Object.Request);

            Assert.IsTrue(result is StatusCodeResult);
            if (result is StatusCodeResult statusCodeResult)
            {
                Assert.AreEqual(expectedStatusCode, statusCodeResult.StatusCode);
            }

            eventLogRepository
            .Verify(x => x.UpsertAsync(It.IsAny <EventLogModel>()), Times.Exactly(expectedSavedItemCount));
        }
Пример #10
0
        public async Task RunAsyncMethod(bool isValid,
                                         bool isValidDevice,
                                         string region,
                                         string verificationPayload,
                                         string platform,
                                         bool isChaffRequest,
                                         HttpStatusCode expectedStatusCode
                                         )
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["SupportRegions"]).Returns("Region1,Region2");

            var tekRepo          = new Mock <ITemporaryExposureKeyRepository>();
            var validationServer = new Mock <IValidationServerService>();

            validationServer.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationServerService.ValidateResult.Success);


            var deviceCheck = new Mock <IDeviceValidationService>();

            deviceCheck.Setup(_ => _.Validation(It.IsAny <string>(), It.IsAny <V3DiagnosisSubmissionParameter>(), It.IsAny <DateTimeOffset>())).ReturnsAsync(isValidDevice);
            var verification = new Mock <IVerificationService>();

            var temporaryExposureKeyValidationService = new Mock <ITemporaryExposureKeyValidationService>();

            temporaryExposureKeyValidationService.Setup(x => x.Validate(It.IsAny <bool>(), It.IsAny <V3DiagnosisSubmissionParameter.Key>())).Returns(true);

            var logger       = new Mock.LoggerMock <V3DiagnosisApi>();
            var diagnosisApi = new V3DiagnosisApi(config.Object,
                                                  tekRepo.Object,
                                                  deviceCheck.Object,
                                                  verification.Object,
                                                  validationServer.Object,
                                                  temporaryExposureKeyValidationService.Object,
                                                  logger);
            var context = new Mock <HttpContext>();
            var keydata = new byte[KEY_LENGTH];

            RandomNumberGenerator.Create().GetBytes(keydata);
            var keyDataString = Convert.ToBase64String(keydata);

            var dateTime = DateTime.UtcNow.AddDays(-7).Date;

            var bodyJson = new V3DiagnosisSubmissionParameter()
            {
                HasSymptom = true,
                OnsetOfSymptomOrTestDate = dateTime.ToString(Constants.FORMAT_TIMESTAMP),
                VerificationPayload      = verificationPayload,
                Regions  = new[] { region },
                Platform = platform,
                DeviceVerificationPayload = "DeviceVerificationPayload",
                AppPackageName            = "Covid19Radar",
                Keys = new V3DiagnosisSubmissionParameter.Key[] {
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-8).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-7).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-6).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-5).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-4).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-3).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-2).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(-1).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(0).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(1).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(2).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(3).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(4).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(5).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(6).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(7).ToRollingStartNumber(), ReportType = 7
                    },
                    new V3DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 144, RollingStartNumber = dateTime.AddDays(8).ToRollingStartNumber(), ReportType = 7
                    },
                }
            };
            var bodyString = JsonConvert.SerializeObject(bodyJson);

            using var stream = new MemoryStream();
            using (var writer = new StreamWriter(stream, leaveOpen: true))
            {
                await writer.WriteAsync(bodyString);

                await writer.FlushAsync();
            }
            stream.Seek(0, SeekOrigin.Begin);

            context.Setup(_ => _.Request.Body).Returns(stream);

            if (isChaffRequest)
            {
                IHeaderDictionary headers = new HeaderDictionary()
                {
                    { "X-Chaff", "Foo" /* Server will check X-Chaff header existence, content no matter. */ }
                };
                context.Setup(_ => _.Request.Headers).Returns(headers);
            }

            // action
            var result = await diagnosisApi.RunAsync(context.Object.Request);

            // assert
            if (result is OkObjectResult okObjectResult)
            {
                Assert.AreEqual(((int)expectedStatusCode), okObjectResult.StatusCode);
            }
            else if (result is BadRequestErrorMessageResult)
            {
                Assert.AreEqual(expectedStatusCode, HttpStatusCode.BadRequest);
            }
        }
Пример #11
0
        public async Task RunAsyncMethod(bool isValid,
                                         bool isValidDevice,
                                         string region,
                                         string verificationPayload,
                                         string platform,
                                         string userUuid)
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["SupportRegions"]).Returns("Region1,Region2");
            var diagnosisRepo = new Mock <IDiagnosisRepository>();

            diagnosisRepo.Setup(_ => _.SubmitDiagnosisAsync(It.IsAny <string>(),
                                                            It.IsAny <DateTimeOffset>(),
                                                            It.IsAny <string>(),
                                                            It.IsAny <TemporaryExposureKeyModel[]>()))
            .ReturnsAsync(new DiagnosisModel());
            var tekRepo          = new Mock <ITemporaryExposureKeyRepository>();
            var validation       = new Mock <IValidationUserService>();
            var validationServer = new Mock <IValidationServerService>();

            validationServer.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationServerService.ValidateResult.Success);

            var validationResult = new IValidationUserService.ValidateResult()
            {
                IsValid = isValid
            };

            validation.Setup(_ => _.ValidateAsync(It.IsAny <HttpRequest>(), It.IsAny <IUser>())).ReturnsAsync(validationResult);
            var deviceCheck = new Mock <IV1DeviceValidationService>();

            deviceCheck.Setup(_ => _.Validation(It.IsAny <V1DiagnosisSubmissionParameter>(), It.IsAny <DateTimeOffset>())).ReturnsAsync(isValidDevice);
            var verification = new Mock <IVerificationService>();
            var logger       = new Mock.LoggerMock <Covid19Radar.Api.DiagnosisApi>();
            var diagnosisApi = new DiagnosisApi(config.Object,
                                                diagnosisRepo.Object,
                                                tekRepo.Object,
                                                validation.Object,
                                                deviceCheck.Object,
                                                verification.Object,
                                                validationServer.Object,
                                                logger);
            var context = new Mock <HttpContext>();
            var keydata = new byte[16];

            RandomNumberGenerator.Create().GetBytes(keydata);
            var keyDataString = Convert.ToBase64String(keydata);
            var startNumber   = (uint)DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 600;
            var bodyJson      = new V1DiagnosisSubmissionParameter()
            {
                VerificationPayload       = verificationPayload,
                Regions                   = new[] { region },
                UserUuid                  = userUuid,
                Platform                  = platform,
                DeviceVerificationPayload = "DeviceVerificationPayload",
                AppPackageName            = "Covid19Radar",
                Keys = new V1DiagnosisSubmissionParameter.Key[] {
                    new V1DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 0, RollingStartNumber = startNumber
                    },
                    new V1DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 0, RollingStartNumber = startNumber
                    }
                }
            };
            var bodyString = Newtonsoft.Json.JsonConvert.SerializeObject(bodyJson);

            using var stream = new System.IO.MemoryStream();
            using (var writer = new System.IO.StreamWriter(stream, leaveOpen: true))
            {
                await writer.WriteAsync(bodyString);

                await writer.FlushAsync();
            }
            stream.Seek(0, System.IO.SeekOrigin.Begin);
            context.Setup(_ => _.Request.Body).Returns(stream);
            // action
            await diagnosisApi.RunAsync(context.Object.Request);

            // assert
        }
Пример #12
0
        public async Task RunAsyncMethod(bool isValid,
                                         bool isValidDevice,
                                         string region,
                                         string verificationPayload,
                                         string platform,
                                         bool isChaffRequest,
                                         HttpStatusCode expectedStatusCode
                                         )
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["SupportRegions"]).Returns("Region1,Region2");

            var tekRepo          = new Mock <ITemporaryExposureKeyRepository>();
            var validationServer = new Mock <IValidationServerService>();

            validationServer.Setup(_ => _.Validate(It.IsAny <HttpRequest>())).Returns(IValidationServerService.ValidateResult.Success);


            var deviceCheck = new Mock <IDeviceValidationService>();

            deviceCheck.Setup(_ => _.Validation(It.IsAny <string>(), It.IsAny <V2DiagnosisSubmissionParameter>(), It.IsAny <DateTimeOffset>())).ReturnsAsync(isValidDevice);
            var verification = new Mock <IVerificationService>();
            var logger       = new Mock.LoggerMock <Covid19Radar.Api.V2DiagnosisApi>();
            var diagnosisApi = new V2DiagnosisApi(config.Object,
                                                  tekRepo.Object,
                                                  deviceCheck.Object,
                                                  verification.Object,
                                                  validationServer.Object,
                                                  logger);
            var context = new Mock <HttpContext>();
            var keydata = new byte[16];

            RandomNumberGenerator.Create().GetBytes(keydata);
            var keyDataString = Convert.ToBase64String(keydata);
            var startNumber   = (uint)DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 600;
            var bodyJson      = new V2DiagnosisSubmissionParameter()
            {
                VerificationPayload       = verificationPayload,
                Regions                   = new[] { region },
                Platform                  = platform,
                DeviceVerificationPayload = "DeviceVerificationPayload",
                AppPackageName            = "Covid19Radar",
                Keys = new V2DiagnosisSubmissionParameter.Key[] {
                    new V2DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 0, RollingStartNumber = startNumber
                    },
                    new V2DiagnosisSubmissionParameter.Key()
                    {
                        KeyData = keyDataString, RollingPeriod = 0, RollingStartNumber = startNumber
                    }
                }
            };
            var bodyString = Newtonsoft.Json.JsonConvert.SerializeObject(bodyJson);

            using var stream = new System.IO.MemoryStream();
            using (var writer = new System.IO.StreamWriter(stream, leaveOpen: true))
            {
                await writer.WriteAsync(bodyString);

                await writer.FlushAsync();
            }
            stream.Seek(0, System.IO.SeekOrigin.Begin);

            context.Setup(_ => _.Request.Body).Returns(stream);

            if (isChaffRequest)
            {
                IHeaderDictionary headers = new HeaderDictionary()
                {
                    { "X-Chaff", "Foo" /* Server will check X-Chaff header existence, content no matter. */ }
                };
                context.Setup(_ => _.Request.Headers).Returns(headers);
            }

            // action
            var result = await diagnosisApi.RunAsync(context.Object.Request);

            // assert
            if (result is StatusCodeResult statusCodeResult)
            {
                Assert.AreEqual(((int)expectedStatusCode), statusCodeResult.StatusCode);
            }
            else if (result is BadRequestErrorMessageResult)
            {
                Assert.AreEqual(expectedStatusCode, HttpStatusCode.BadRequest);
            }
        }