Exemplo n.º 1
0
        private static void VerifyInjectionCreatePhaseFlow(InjectionInput injection, string param)
        {
            var handler  = new DefaultManager();
            var flowData = new Dictionary <string, object>
            {
                ["flow"] = PhaseFlowTestData.GetFlow(PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId], PhaseFlowTestData.Flow.AllId),
                ["id"]   = PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId],
            };

            flowData[param] = InjectionInputData.InjectionInputMapper[injection];
            var request = new Dictionary <string, object>()
            {
                ["phaseFlow"] = flowData
            }.ToJson();
            var readResponse = handler.SendAsync <object>(PhaseFlowTestData.PhaseFlowApi, request, HttpMethod.POST).Result;

            PrAssert.That(readResponse, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to Create Phase Flow");
        }
Exemplo n.º 2
0
        public void ValidCreatePhaseFlow(ResourceId resource, PhaseFlowTestData.ValidPhaseId id, PhaseFlowTestData.Flow flow)
        {
            var handler = new DefaultManager();
            var request = new Dictionary <string, object>()
            {
                ["phaseFlow"] = new List <Dictionary <string, object> >
                {
                    new Dictionary <string, object>
                    {
                        ["flow"] = PhaseFlowTestData.GetFlow(PhaseFlowTestData.ValidPhaseIdMapper[resource][PhaseFlowTestData.ValidPhaseId.ChildId], flow),
                        ["id"]   = PhaseFlowTestData.ValidPhaseIdMapper[resource][id],
                    }
                }
            }.ToJson();
            var createResponse = handler.SendAsync <object>(PhaseFlowTestData.PhaseFlowApi, request, HttpMethod.POST).Result;

            PrAssert.That(createResponse, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not Create Phase Flow");
        }
Exemplo n.º 3
0
        public void InvalidJsonCreatePhaseFlow(OriginalSearchHelpers.InvalidSpecialCondition json)
        {
            var handler  = new DefaultManager();
            var flowData = new Dictionary <string, object>
            {
                ["flow"] = PhaseFlowTestData.GetFlow(PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId], PhaseFlowTestData.Flow.AllId),
                ["id"]   = PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId],
            };
            var request = new Dictionary <string, object>()
            {
                ["phaseFlow"] = new List <Dictionary <string, object> >
                {
                    flowData
                }
            }.ToJson();
            var readResponse = handler.SendAsync <object>(PhaseFlowTestData.PhaseFlowApi, SublistMenuTestData.InvalidBodyJsonTestCasesMapper[json](request), HttpMethod.POST).Result;

            PrAssert.That(readResponse, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to Create Phase Flow");
        }
Exemplo n.º 4
0
        public void InvalidCreatePhaseFlow(PhaseFlowTestData.InvalidValue invalidValue, string param)
        {
            var handler  = new DefaultManager();
            var flowData = new Dictionary <string, object>
            {
                ["flow"] = PhaseFlowTestData.GetFlow(PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId], PhaseFlowTestData.Flow.AllId),
                ["id"]   = PhaseFlowTestData.ValidPhaseIdMapper[ResourceId.Client][PhaseFlowTestData.ValidPhaseId.PhaseId],
            };

            PhaseFlowTestData.InvalidValueMapper[invalidValue](flowData, param);
            var request = new Dictionary <string, object>()
            {
                ["phaseFlow"] = new List <Dictionary <string, object> >
                {
                    flowData
                }
            }.ToJson();
            var createResponse = handler.SendAsync <object>(PhaseFlowTestData.PhaseFlowApi, request, HttpMethod.POST).Result;

            PrAssert.That(createResponse, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to Create Phase Flow");
        }