public static void SendAndVerifySpecialCase(int fieldType, ResourceId resourceId, NumberHelpers.ValidUpdateField validUpdateField, string fieldUUID) { var handler = new DefaultManager(); var properties = NumberHelpers.GenerateRequiredProperties(fieldType, Properties.Label.Min); NumberHelpers.ValidUpdateMapperValue[validUpdateField](properties); var updateParam = NumberHelpers.GenerateUpdateParam(resourceId, properties); var request = NumberHelpers.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.Min]), "Not as expected d.label.ja"); if (validUpdateField == ValidUpdateField.SchemaEnabled) { PrAssert.That(readResponse.Result.Values.First().Value.Properties.ContainsKey(validUpdateField.GetEnumStringValue()), PrIs.EqualTo(false), $"Not as expected {validUpdateField.GetEnumStringValue()}"); } else { PrAssert.That(readResponse.Result.Values.First().Value.Properties[validUpdateField.GetEnumStringValue()], PrIs.Not.EqualTo(properties[validUpdateField.GetEnumStringValue()]), $"Not as expected {validUpdateField.GetEnumStringValue()}"); } }
public static void SendAndVerifySpecialCase(int fieldType, ResourceId resourceId, NumberHelpers.InvalidUpdateField invalidUpdateField, string fieldUUID) { var handler = new DefaultManager(); var properties = NumberHelpers.GenerateRequiredProperties(fieldType, Properties.Label.Min); NumberHelpers.InvalidUpdateMapperValue[invalidUpdateField](properties); var updateParam = NumberHelpers.GenerateUpdateParam(resourceId, properties); var request = NumberHelpers.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.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able update Field"); }
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, Properties.Min min, Properties.Max max, Properties.Scale scale, string fieldUUID) { var handler = new DefaultManager(); var properties = NumberHelpers.GenerateProperties(fieldType, Properties.Label.Max, caption, search, match, highlight, require, defaultProperty, min, max, scale); var updateParam = NumberHelpers.GenerateUpdateParam(resourceId, properties); var request = NumberHelpers.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"); NumberHelpers.VerifyProperties(readResponse.Result.Values.First().Value.Properties, properties); }