Exemplo n.º 1
0
        public void ValidCreateMenuTest(ResourceId resource, SublistMenuTestData.LabelValue labelValue, MainMenuTestData.Condition condition, MainMenuTestData.Alias alias, MainMenuTestData.Join join)
        {
            var handler     = new DefaultManager();
            var requestJson = GetCreateMenuRequest((int)resource, GetLabelValue(SublistMenuTestData.ValidLabelMapper[labelValue]));

            requestJson["conditions"] = GetConditionValue($"{resource.ToAlias()}.{MainMenuTestData.ValidAliasMapper[alias]("")}", join.ToString().ToUpper(), new List());
            var createResponse = handler.SendAsync <CreateMenuResponse>(SublistMenuTestData.MenuEndPoint, requestJson.ToJson(), HttpMethod.POST).Result;

            PrAssert.That(createResponse, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Not able to create a menu");
            PrAssert.That(createResponse.Result.Id, PrIs.Not.Null.And.Not.Empty, "Not able to create a menu");
        }
Exemplo n.º 2
0
        public void ValidUpdateMenuTest(ResourceId resource, SublistMenuTestData.LabelValue labelValue, MainMenuTestData.Condition condition, MainMenuTestData.Alias alias, MainMenuTestData.Join join)
        {
            var handler     = new DefaultManager();
            var requestJson = GetUpdateMenuRequest(SublistMenuTestData.ValidMenuIdMapper[resource], (int)resource, GetLabelValue(SublistMenuTestData.ValidLabelMapper[labelValue]));

            requestJson["conditions"] = GetConditionValue($"{resource.ToAlias()}.{MainMenuTestData.ValidAliasMapper[alias]("")}", join.ToString().ToUpper(), new List());
            var updateResponse = handler.SendAsync <object>(SublistMenuTestData.MenuEndPoint, requestJson.ToJson(), HttpMethod.PUT).Result;

            PrAssert.That(updateResponse, PrIs.SuccessfulResponse(), "Not able to update a menu");
        }