コード例 #1
0
        public void TestInvalidCreatePhaseTemplateInjection(Phase param, Enums.InvalidInjection invalid)
        {
            var handler = new DefaultManager();
            var request = BuildCreateTemplateWithProcessRequest(OptionPhaseProcess, OptionEndReason, PhaseType.One, CommonEnums.String, EndFlag.True, EndReason.Valid);
            var phase   = request[Parameters.Phase.GetEnumStringValue()] as Dictionary <string, object>;

            phase[param.GetEnumStringValue()] = MapperData.InvalidInjectionMapper[invalid];
            request[Parameters.Phase.GetEnumStringValue()] = phase;
            var response = handler.Send <object>(TemplateEndPoint, JsonConvert.SerializeObject(request), HttpMethod.POST);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
コード例 #2
0
        public void TestInvalidCreateTemplateWithPhase(Phase param, Enum invalid)
        {
            var handler = new DefaultManager();
            var request = BuildCreateTemplateWithProcessRequest(OptionPhaseProcess, OptionEndReason, PhaseType.One, CommonEnums.String, EndFlag.True, EndReason.Valid);
            var phases  = request[Parameters.Phase.GetEnumStringValue()] as Dictionary <string, object>;

            if (param != Phase.Resource)
            {
                InvalidValueMapper[(InvalidValue)invalid](phases, param.GetEnumStringValue());
            }
            else
            {
                phases[Phase.Resource.GetEnumStringValue()] = invalid.ToString();
            }
            request[Parameters.Phase.GetEnumStringValue()] = phases;
            var response = handler.Send <object>(TemplateEndPoint, JsonConvert.SerializeObject(request), HttpMethod.POST);

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