public void ValidDuplicateCreateField(ResourceId resourceId, System.Enum param, Enums.ValidDuplicated validDuplicated)
        {
            var handler         = new DefaultManager();
            var properties      = FileHelpers.GenerateProperties(FileFieldTestData.FileFieldType, Properties.Label.Max, Properties.Caption.Min, Properties.Search.True, Properties.Match.True, Properties.Highlight.True, Properties.Require.True, Properties.Default.Null, FileType.Bmp, Properties.Height.Max);
            var otherProperties = FileHelpers.GenerateProperties(FileFieldTestData.FileFieldType, Properties.Label.Min, Properties.Caption.Max, Properties.Search.False, Properties.Match.False, Properties.Highlight.False, Properties.Require.False, Properties.Default.Null, FileType.Png, Properties.Height.Min);
            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 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 });
        }
Beispiel #3
0
        public void TestCreateDuplicateParametersValid(ResourceId resource, Enums.ValidDuplicated dupType, Enum param)
        {
            var handler                = new DefaultManager();
            var propertiesSameValue    = new Dictionary <string, object>(PropertiesSameValue);
            var propertiesNotSameValue = new Dictionary <string, object>(PropertiesNotSameValue);
            var request                = CommonHelpers.CreateDuplicateRequest(resource, propertiesSameValue, propertiesNotSameValue, param, dupType);
            var response               = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, request, TestCoreFramework.Enums.HttpMethod.POST);

            if (dupType == Enums.ValidDuplicated.NotSameValue && (Properties.PropertyName)param == Properties.PropertyName.Default)
            {
                PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
            }
            else
            {
                PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            }
        }
Beispiel #4
0
        public void TestCreateDuplicateParametersValid(ResourceId resource, Enums.ValidDuplicated dupType, Enum param)
        {
            var handler                = new DefaultManager();
            var propertiesSameValue    = new Dictionary <string, object>(PropertiesSameValue);
            var propertiesNotSameValue = new Dictionary <string, object>(PropertiesNotSameValue);

            propertiesSameValue[Properties.PropertyName.Field.GetEnumStringValue()]    = UuidUtil.GetId(FieldsCreator.Data[$"{Defines.ReferenceResource[resource].First()}-{FieldType.Mail.ToString()}-2"].Guid);
            propertiesNotSameValue[Properties.PropertyName.Field.GetEnumStringValue()] = UuidUtil.GetId(FieldsCreator.Data[$"{Defines.ReferenceResource[resource].Last()}-{FieldType.Mail.ToString()}-3"].Guid);
            var request  = CommonHelpers.CreateDuplicateRequest(resource, propertiesSameValue, propertiesNotSameValue, param, dupType);
            var response = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, request, TestCoreFramework.Enums.HttpMethod.POST);

            if (dupType == Enums.ValidDuplicated.NotSameValue && param.ToString() == Properties.Parameters.Resource.ToString())
            {
                PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
            }
            else
            {
                PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            }
        }