Пример #1
0
        public void ValidDuplicatePutQueueTest(QueueParam param, Enums.ValidDuplicated duplicated)
        {
            var request = new Dictionary <string, object>
            {
                [QueueParam.Id.ToString().ToLower()]     = $"{PreparedQueueId.Data[ValidQueueTask.Export]}",
                [QueueParam.Status.ToString().ToLower()] = ValidStatus.Interrupted.GetEnumStringValue(),
            };
            var otherValue = new Dictionary <string, object>
            {
                [QueueParam.Id.ToString().ToLower()]     = $"{PreparedQueueId.Data[ValidQueueTask.Import]}",
                [QueueParam.Status.ToString().ToLower()] = ValidStatus.Executing.GetEnumStringValue(),
            };

            request.Add($"{param.GetEnumStringValue()}_dup", duplicated == Enums.ValidDuplicated.SameValue ? request[param.GetEnumStringValue()] : otherValue[param.GetEnumStringValue()]);
            var defaultManager = new DefaultManager();
            var requestJson    = request.ToJson().Replace($"{param.GetEnumStringValue()}_dup", param.GetEnumStringValue());
            var response       = defaultManager.Send <object>(QueueTestCaseData.QueueEndpoint, requestJson, HttpMethod.PUT);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #2
0
        public void InvalidInjectionPutQueueTest(QueueParam param, Enums.InvalidInjection invalid)
        {
            var request = new Dictionary <string, object>
            {
                [QueueParam.Id.ToString().ToLower()]     = $"{PreparedQueueId.Data[ValidQueueTask.Export]}",
                [QueueParam.Status.ToString().ToLower()] = ValidStatus.Interrupted.GetEnumStringValue(),
            };

            request[param.GetEnumStringValue()] = InvalidInjectionInputData.InjectionInputMapper[invalid];
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <object>(QueueTestCaseData.QueueEndpoint, request.ToJson(), HttpMethod.PUT);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #3
0
        public void InvalidGetQueueTest(QueueParam param, InvalidValue invalid)
        {
            var request = new Dictionary <string, string>
            {
                [QueueParam.Id.ToString().ToLower()]   = $"{PreparedQueueId.Data[ValidQueueTask.Export]}",
                [QueueParam.Type.ToString().ToLower()] = ValidQueueTask.Export.GetEnumStringValue(),
            };

            QueueTestCaseData.ValidScopeValueMapper[ValidScope.Own](request);
            QueueTestCaseData.InvalidRequestValuesMapper[invalid](param.GetEnumStringValue(), request);
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <object>(QueueTestCaseData.QueueEndpoint, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #4
0
        public void InvalidInjectionGetQueuesTest(QueueParam param, Enums.InvalidInjection invalid)
        {
            var request = new Dictionary <string, string>
            {
                [QueueParam.Type.ToString().ToLower()] = QueueTestCaseData.ValidTypeValueMapper[ValidType.All],
            };

            QueueTestCaseData.ValidUnderscoreValueMapper[ValidUnderScore.UnixTime](request);
            QueueTestCaseData.ValidScopeValueMapper[ValidScope.Own](request);
            request[param.GetEnumStringValue()] = InvalidInjectionInputData.InjectionInputMapper[invalid];
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <object>(QueueTestCaseData.QueuesEndpoint, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #5
0
        public void ValidDuplicateGetQueuesTest(QueueParam param, Enums.ValidDuplicated duplicated)
        {
            var request = new Dictionary <string, string>
            {
                [QueueParam.Type.ToString().ToLower()] = QueueTestCaseData.ValidTypeValueMapper[ValidType.All],
            };

            QueueTestCaseData.ValidUnderscoreValueMapper[ValidUnderScore.UnixTime](request);
            QueueTestCaseData.ValidScopeValueMapper[ValidScope.Own](request);
            var requestDup = request.ToList();

            requestDup.Add(new KeyValuePair <string, string>(param.GetEnumStringValue(), duplicated == Enums.ValidDuplicated.SameValue ? request[param.GetEnumStringValue()] : ""));
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <object>(QueueTestCaseData.QueuesEndpoint, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }