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); }
public void ValidDuplicateCreateField(ResourceId resourceId, System.Enum param, Enums.ValidDuplicated validDuplicated) { var handler = new DefaultManager(); var properties = NumberHelpers.GenerateProperties(NumberFieldTestData.NumberFieldType, Properties.Label.Max, Properties.Caption.Min, Properties.Search.True, Properties.Match.True, Properties.Highlight.True, Properties.Require.True, Properties.Default.EqualTo, Properties.Min.EqualToMax, Properties.Max.EqualToMin, Properties.Scale.One); var otherProperties = NumberHelpers.GenerateProperties(NumberFieldTestData.NumberFieldType, Properties.Label.Min, Properties.Caption.Max, Properties.Search.False, Properties.Match.False, Properties.Highlight.False, Properties.Require.False, Properties.Default.LessThan, Properties.Min.LessThanMax, Properties.Max.GreaterThanMin, Properties.Scale.One); if (param.GetEnumStringValue() == Properties.PropertyName.Scale.GetEnumStringValue() && validDuplicated == Enums.ValidDuplicated.NotSameValue) { NumberHelpers.ScaleMapperValue[Properties.Scale.Two](properties); } var request = CommonHelpers.CreateDuplicateRequest(resourceId, properties, otherProperties, param, validDuplicated); 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"); CommonHelpers.DeleteField(new[] { response.Result.Id }); }
public void ValidDuplicateUpdateUserField(ResourceId resourceId, System.Enum param, Enums.ValidDuplicated validDuplicated) { var fieldUUID = PreparedFieldId.Data[$"{resourceId}0"]; var otherFieldUUID = PreparedFieldId.Data[$"{resourceId}1"]; var handler = new DefaultManager(); var properties = NumberHelpers.GenerateProperties(CurrencyFieldTestData.CurrencyFieldType, Properties.Label.Max, Properties.Caption.Min, Properties.Search.True, Properties.Match.True, Properties.Highlight.True, Properties.Require.True, Properties.Default.EqualTo, Properties.Min.EqualToMax, Properties.Max.EqualToMin, Properties.Scale.One); var otherProperties = NumberHelpers.GenerateProperties(CurrencyFieldTestData.CurrencyFieldType, Properties.Label.Min, Properties.Caption.Max, Properties.Search.False, Properties.Match.False, Properties.Highlight.False, Properties.Require.False, Properties.Default.LessThan, Properties.Min.LessThanMax, Properties.Max.GreaterThanMin, Properties.Scale.One); if (param.GetEnumStringValue() == Properties.PropertyName.Scale.GetEnumStringValue() && validDuplicated == Enums.ValidDuplicated.NotSameValue) { NumberHelpers.ScaleMapperValue[Properties.Scale.Two](properties); } var request = CommonHelpers.UpdateDuplicateRequest(resourceId, fieldUUID, otherFieldUUID, properties, otherProperties, param, validDuplicated); 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"); }