Example #1
0
        public void TestCreateEnumMetadataField()
        {
            var singleEntry = new List <EntryParams>
            {
                new EntryParams("v1", datasourceEntryExternalId)
            };
            var datasourceSingle = new MetadataDataSourceParams(singleEntry);
            var parameters       = new EnumMetadataFieldCreateParams(externalIdEnum)
            {
                ExternalId = externalIdEnum,
                DataSource = datasourceSingle
            };

            mockedCloudinary.AddMetadataField(parameters);

            mockedCloudinary.AssertHttpCall(SystemHttp.HttpMethod.Post, "metadata_fields");
            AssertEncodedRequestFields(mockedCloudinary, "enum", externalIdEnum, singleEntry[0]);
        }
Example #2
0
        public void TestEnumMetadataFieldCreateParamsDictionary()
        {
            var entries = new List <EntryParams>
            {
                new EntryParams(dataSourceValue1, dataSourceId),
                new EntryParams(dataSourceValue2)
            };
            var parameters = new EnumMetadataFieldCreateParams(label)
            {
                Mandatory    = true,
                DefaultValue = defaultString,
                ExternalId   = externalId,
                DataSource   = new MetadataDataSourceParams(entries)
            };

            var dictionary = CheckParamsDictionary(parameters, "enum", defaultString);

            Assert.NotNull(dictionary["datasource"]);
        }
Example #3
0
        public void TestEnumMetadataFieldCreateParamsCheck()
        {
            var parameters = new EnumMetadataFieldCreateParams(null);

            AssertCheck(parameters, emptyLabelTestMessage);

            parameters.Label     = label;
            parameters.Mandatory = true;
            AssertCheck(parameters, emptyDefaultValueTestMessage);

            parameters.DefaultValue = defaultString;
            AssertCheck(parameters, emptyDataSourceTestMessage);

            var entryParams = new List <EntryParams>
            {
                new EntryParams(defaultString)
            };

            parameters.DataSource = new MetadataDataSourceParams(entryParams);
            parameters.Validation = new StringLengthValidationParams();
            AssertCheck(parameters, nonEmptyValidationTestMessage);
        }