public void ValidUpdateApplicationFieldOptionalProperties(ResourceId resourceId, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, Properties.Min min, Properties.Max max, Properties.Scale scale)
        {
            string fieldUUID = ApplicationFieldId.Data[resourceId].ToString();

            NumberHelpers.SendAndVerifyRequest(NumberFieldTestData.NumberFieldType, resourceId, Properties.Alias.Min, caption, search, match, highlight, require, defaultProperty, min, max, scale, fieldUUID);
        }
Exemplo n.º 2
0
        public static void SendAndVerifyRequest(int fieldType, ResourceId resourceId, Properties.Alias alias, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, FileType mimeType, Properties.Height height, string fieldUUID)
        {
            var handler     = new DefaultManager();
            var properties  = GenerateProperties(fieldType, Properties.Label.Max, caption, search, match, highlight, require, defaultProperty, mimeType, height);
            var updateParam = GenerateUpdateParam(resourceId, properties);
            var request     = GenerateRequestUpdate(fieldUUID, updateParam).ToJson();

            PrAssert.That(request, PrIs.Not.EqualTo(string.Empty));
            var response = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.PUT);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not update Field");
            var fieldHandler = new FieldManager();
            var readResponse = fieldHandler.GetFieldDetails(new Guid(fieldUUID));

            PrAssert.That(readResponse, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not Read Field");
            PrAssert.That(readResponse.Result.Values.Count, PrIs.EqualTo(1), "Can not read Field");
            PrAssert.That(readResponse.Result.Values.First().Value.Properties[Properties.PropertyName.SType.GetEnumStringValue()], PrIs.EqualTo($"{fieldType}"), "Not as expected s.type");
            PrAssert.That(readResponse.Result.Values.First().Value.Properties[Properties.PropertyName.Label.GetEnumStringValue()], PrIs.EqualTo(CommonMapperValue.LabelMapperValue[Properties.Label.Max]), "Not as expected d.label.ja");
            VerifyProperties(readResponse.Result.Values.First().Value.Properties, properties);
        }
Exemplo n.º 3
0
        public void TestCreateOptionalParameterValid(ResourceId resource, Properties.Alias alias, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Length length, Properties.Default deft, Properties.Height height)
        {
            var handler    = new DefaultManager();
            var properties = TextHelpers.GenerateWithRequireProperties(Defines.FieldTypeApi, caption, search, match, web, highlight, require, length, deft, height);
            var request    = TextHelpers.GenerateCreateRequest(resource, alias, properties);
            var response   = handler.Send <FieldCreateResponse>(FieldManager.FieldHandlingRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            PrAssert.That(response.Result.Id, PrIs.Not.Null.Or.Not.Empty);

            var result = (new FieldManager()).GetFieldDetails(response.Result.Id);

            //Clearn up
            CommonHelpers.DeleteField(new List <Guid> {
                response.Result.Id
            });
            //Verify
            PrAssert.That(result.Result.Values.SingleOrDefault().Value.Id, PrIs.EqualTo(response.Result.Id));
            TextHelpers.VerifyProperties(result.Result.Values.SingleOrDefault().Value.Properties, properties);
        }
Exemplo n.º 4
0
        public void TestUpdateOptionalParameterValid(ResourceId resource, TextHelpers.FieldTypes fType, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Length length, Properties.Default deft)
        {
            var guid = TextHelpers.Guid[fType](resource, FieldsCreator, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().First());

            //Update lenght to avoid missing lenght case if other tests effect to preparing data
            TextHelpers.UpdateLenghtProperty(resource, Defines.FieldTypeApi, guid);

            var handler  = new DefaultManager();
            var props    = TextHelpers.GeneratePropertiesWithoutRequired(Defines.FieldTypeApi, caption, search, match, web, highlight, require, length, deft);
            var request  = TextHelpers.GenerateUpdateRequest(resource, guid.ToString(), props);
            var response = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.PUT);

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

            //Verify
            var result = (new FieldManager()).GetFieldDetails(guid);

            TextHelpers.VerifyProperties(result.Result.Values.SingleOrDefault().Value.Properties, props);
        }
Exemplo n.º 5
0
        public static Dictionary <string, object> GenerateProperties(int fieldType, Properties.Label label, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, FileType mimeType, Properties.Height height)
        {
            var properties = GenerateRequiredProperties(fieldType, label, mimeType);

            CommonMapperValue.CaptionMapperValue[caption](properties);
            CommonMapperValue.SearchMapperValue[search](properties);
            CommonMapperValue.MatchMapperValue[match](properties);
            CommonMapperValue.HighlightMapperValue[highlight](properties);
            CommonMapperValue.RequireMapperValue[require](properties);
            DefaultMapperValue[defaultProperty](properties);
            HeightMapperValue[height](properties);
            return(properties);
        }
Exemplo n.º 6
0
        public void TestCreateOptionalParameterValid(ResourceId resource, Properties.Alias alias, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require)
        {
            var id         = UuidUtil.GetId(FieldsCreator.Data[$"{Defines.ReferenceResource[resource].First()}-{HRBCClientPrivate.API.Field.FieldType.Mail.ToString()}-0"].Guid);
            var handler    = new DefaultManager();
            var properties = TextHelpers.GenerateWithRequireProperties(Defines.FieldTypeApi, caption, search, match, web, highlight, require);

            properties[Properties.PropertyName.Field.GetEnumStringValue()] = id;
            var request  = TextHelpers.GenerateCreateRequest(resource, alias, properties);
            var response = handler.Send <FieldCreateResponse>(FieldManager.FieldHandlingRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            PrAssert.That(response.Result.Id, PrIs.Not.Null.Or.Not.Empty);

            var result = (new FieldManager()).GetFieldDetails(response.Result.Id);

            //Clearn up
            CommonHelpers.DeleteField(new List <Guid> {
                response.Result.Id
            });
            //Verify
            PrAssert.That(result.Result.Values.SingleOrDefault().Value.Id, PrIs.EqualTo(response.Result.Id));
            TextHelpers.VerifyProperties(result.Result.Values.SingleOrDefault().Value.Properties, properties);
        }
Exemplo n.º 7
0
        public void ValidUpdateApplicationFieldOptionalProperties(ResourceId resourceId, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, FileType mimeType, Properties.Height height)
        {
            string fieldUUID = ApplicationFieldId.Data[resourceId].ToString();

            FileHelpers.SendAndVerifyRequest(FileFieldTestData.FileFieldType, resourceId, Properties.Alias.Min, caption, search, match, highlight, require, defaultProperty, mimeType, height, fieldUUID);
        }
Exemplo n.º 8
0
        public static Dictionary <string, object> GeneratePropertiesWithoutRequired(FieldType fType, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Length length = Properties.Length.Missing, Properties.Default deft = Properties.Default.Null, Properties.Height height = Properties.Height.Missing)
        {
            var properties = new Dictionary <string, object>();

            CommonMapperValue.CaptionMapperValue[caption](properties);
            CommonMapperValue.SearchMapperValue[search](properties);
            CommonMapperValue.MatchMapperValue[match](properties);
            CommonMapperValue.WebMapperValue[web](properties);
            CommonMapperValue.HighlightMapperValue[highlight](properties);
            CommonMapperValue.RequireMapperValue[require](properties);
            LenghtMapperValue[length](fType, properties);
            DefaultMapperValue[deft](fType, properties);
            if (fType == FieldType.MultiLinesText)
            {
                HeightMapperValue[height](properties);
            }
            return(properties);
        }
Exemplo n.º 9
0
 public static Dictionary <string, object> GenerateWithRequireProperties(FieldType fType, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Length length = Properties.Length.Missing, Properties.Default deft = Properties.Default.Null, Properties.Height height = Properties.Height.Missing)
 {
     return(RequiredProperties(fType).Union(GeneratePropertiesWithoutRequired(fType, caption, search, match, web, highlight, require, length, deft, height)).ToDictionary(k => k.Key, v => v.Value));
 }
Exemplo n.º 10
0
        public void ValidCreateFieldOptionalProperties(ResourceId resourceId, Properties.Alias alias, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, Properties.Min min, Properties.Max max, Properties.Scale scale)
        {
            var handler     = new DefaultManager();
            var properties  = NumberHelpers.GenerateProperties(NumberFieldTestData.NumberFieldType, Properties.Label.Max, caption, search, match, highlight, require, defaultProperty, min, max, scale);
            var createParam = new Dictionary <string, object>
            {
                [Properties.Parameters.Resource.GetEnumStringValue()]   = resourceId.ToString().ToLower(),
                [Properties.Parameters.Alias.GetEnumStringValue()]      = "",
                [Properties.Parameters.Properties.GetEnumStringValue()] = properties
            };

            CommonMapperValue.AliasMapperValue[alias](createParam);
            var request = new Dictionary <string, object>
            {
                [Properties.Parameters.Create.GetEnumStringValue()] = createParam
            }.ToJson();

            PrAssert.That(request, PrIs.Not.EqualTo(string.Empty));
            var response = handler.Send <FieldCreateResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not Create Field");
            var fieldHandler = new FieldManager();
            var readResponse = fieldHandler.GetFieldDetails(response.Result.Id);

            CommonHelpers.DeleteField(new[] { response.Result.Id });
            PrAssert.That(readResponse, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not Read Field");
            PrAssert.That(readResponse.Result.Values.Count, PrIs.EqualTo(1), "Can not read Field");
            PrAssert.That(readResponse.Result.Values.First().Value.Properties[Properties.PropertyName.SType.GetEnumStringValue()], PrIs.EqualTo($"{NumberFieldTestData.NumberFieldType}"), "Not as expected s.type");
            PrAssert.That(readResponse.Result.Values.First().Value.Properties[Properties.PropertyName.Label.GetEnumStringValue()], PrIs.EqualTo(CommonMapperValue.LabelMapperValue[Properties.Label.Max]), "Not as expected d.label.ja");
            NumberHelpers.VerifyProperties(readResponse.Result.Values.First().Value.Properties, properties);
        }
Exemplo n.º 11
0
        public void TestUpdateOptionalParameterValid(ResourceId resource, TextHelpers.FieldTypes fType, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Web web, Properties.Highlight highlight, Properties.Require require)
        {
            var guid    = GuidsForUpdate[resource].Values.First();
            var id      = UuidUtil.GetId(FieldsCreator.Data[$"{Defines.ReferenceResource[resource].First()}-{HRBCClientPrivate.API.Field.FieldType.SingleLineText.ToString()}-2"].Guid);
            var handler = new DefaultManager();
            var props   = TextHelpers.GeneratePropertiesWithoutRequired(Defines.FieldTypeApi, caption, search, match, web, highlight, require);

            props[Properties.PropertyName.Field.GetEnumStringValue()] = id;
            var request  = TextHelpers.GenerateUpdateRequest(resource, guid.ToString(), props);
            var response = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.PUT);

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

            //Verify
            var result = (new FieldManager()).GetFieldDetails(guid);

            TextHelpers.VerifyProperties(result.Result.Values.SingleOrDefault().Value.Properties, props);
        }
Exemplo n.º 12
0
        public static Dictionary <string, object> GenerateProperties(int fieldType, Properties.Label label, Properties.Caption caption, Properties.Search search, Properties.Match match, Properties.Highlight highlight, Properties.Require require, Properties.Default defaultProperty, Properties.Min min, Properties.Max max, Properties.Scale scale)
        {
            var properties = GenerateRequiredProperties(fieldType, label);

            CommonMapperValue.CaptionMapperValue[caption](properties);
            CommonMapperValue.SearchMapperValue[search](properties);
            CommonMapperValue.MatchMapperValue[match](properties);
            CommonMapperValue.HighlightMapperValue[highlight](properties);
            CommonMapperValue.RequireMapperValue[require](properties);
            NumberHelpers.DefaultMapperValue[defaultProperty](scale, properties);
            NumberHelpers.MinMapperValue[min](properties);
            NumberHelpers.MaxMapperValue[max](properties);
            NumberHelpers.ScaleMapperValue[scale](properties);
            return(properties);
        }