コード例 #1
0
        public void TestFieldSearchValidCases(ResourceId resourceId, Selects.ValidSelect validSelect)
        {
            var fieldHandler = new FieldManager();
            var request      = new List <KeyValuePair <string, string> >();

            AddDefaultRequestValue(resourceId, request);
            request.AddRange(Selects.SelectMapperValue[validSelect]);
            var response = fieldHandler.GetFieldGuid(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), $"Read a field operation was not successful. HTTP response code is {response.HttpStatusCode}");
            PrAssert.That(response.Result.Result, PrIs.Not.Empty.Or.Null, "The search result is empty");
            Selects.VerifyContainExpectedSelect(response.Result, new[] { validSelect });
        }
コード例 #2
0
        public void ValidTests(ResourceId resourceId, FieldType fieldType)
        {
            var request = new Dictionary <string, object>
            {
                [Selects.IdParam]     = PrepareField.Data[$"{resourceId}_{fieldType}_{NumberOfField-1}"].Guid.ToString(),
                [Selects.SelectParam] = Selects.Select.Alias.GetEnumStringValue()
            };
            var manager  = new DefaultManager();
            var response = manager.Send <FieldDetailsResponse>(Endpoint, request.ToJson(), HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not read field");
            // Verify response data
            Selects.VerifyContainExpectedSelect(response.Result, Selects.ValidSelect.Alias);
        }
コード例 #3
0
        public void ValidReadUserField(ResourceId resourceId, CommonMapperValue.ValidReadId validId, Selects.ValidSelect validSelect)
        {
            string fieldFirstUUID     = PreparedFieldId.Data[$"{resourceId}0"].ToString();
            string fieldSecondUUID    = PreparedFieldId.Data[$"{resourceId}1"].ToString();
            string appFieldFirstUUID  = ApplicationFieldId.Data[resourceId].ToString();
            string appFieldSecondUUID = SecondApplicationFieldId.Data[resourceId].ToString();
            string sysFieldUUID       = SystemFields.GetSytemFieldUuidByFieldType(resourceId, NumberFieldTestData.TestingFieldType);
            var    request            = CommonMapperValue.ValidReadUUIDMapperValue[validId](fieldFirstUUID, fieldSecondUUID, appFieldFirstUUID, appFieldSecondUUID, sysFieldUUID);

            request.AddRange(Selects.SelectMapperValue[validSelect]);
            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(HttpStatusCode.OK), "Could not read field details");
            Selects.VerifyContainExpectedSelect(response.Result, validSelect);
        }
コード例 #4
0
        public void TestReadFieldValid(ResourceId resource, ValidReadId validReadId, Selects.ValidSelect select)
        {
            var firstUuidUser  = FirstGuidsForRead[resource].Values.First().ToString();
            var secondUuidUser = SecondGuidsForRead[resource].Values.Last().ToString();

            var idParams = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, string.Empty, string.Empty, string.Empty);
            var sel      = Selects.SelectMapperValue[select];
            var request  = new List <KeyValuePair <string, string> >();

            request.AddRange(idParams);
            request.AddRange(sel);
            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));

            //Verify
            Selects.VerifyContainExpectedSelect(response.Result, select);
        }
コード例 #5
0
ファイル: ReadFieldTests.cs プロジェクト: tranxuannam/bk_data
        public void TestReadFieldValid(ResourceId resource, ValidReadId validReadId, Selects.ValidSelect select)
        {
            var firstUuidUser  = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-0"].Guid.ToString();
            var secondUuidUser = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-1"].Guid.ToString();
            var firstUuidApp   = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().First()).ToString();
            var secondUuidApp  = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().Last()).ToString();

            var idParams = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, firstUuidApp, secondUuidApp, SystemFields.GetSytemFieldUuidByFieldType(resource, FieldType.SingleLineText));
            var sel      = Selects.SelectMapperValue[select];
            var request  = new List <KeyValuePair <string, string> >();

            request.AddRange(idParams);
            request.AddRange(sel);
            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));

            //Verify
            Selects.VerifyContainExpectedSelect(response.Result, select);
        }