示例#1
0
        public void GetResourceTypesParameterReferenceWithNoMatchingParameterDefinition()
        {
            const string     provider          = "Microsoft.Network";
            const string     pathAfterProvider = "dnszones/{zoneName}/{recordType}/{relativeRecordSetName}";
            List <Parameter> methodParameters  = new List <Parameter>();

            Assert.Throws <ArgumentException>(() => { ResourceSchemaParser.GetResourceTypes(provider, pathAfterProvider, methodParameters); });
        }
示例#2
0
        public void GetResourceTypesWithParameterReferenceWithParameterDefinitionWithEnumTypeWithNoValues()
        {
            const string     provider          = "Microsoft.Network";
            const string     pathAfterProvider = "dnszones/{zoneName}/{recordType}/{relativeRecordSetName}";
            List <Parameter> methodParameters  = new List <Parameter>()
            {
                new Parameter()
                {
                    Name = "recordType",
                    Type = new EnumType()
                }
            };

            Assert.Throws <ArgumentException>(() => { ResourceSchemaParser.GetResourceTypes(provider, pathAfterProvider, methodParameters); });
        }
示例#3
0
        public void GetResourceTypesWithParameterReferenceWithParameterDefinitionWithEnumTypeWithMultipleValues()
        {
            const string provider          = "Microsoft.Network";
            const string pathAfterProvider = "dnszones/{zoneName}/{recordType}/{relativeRecordSetName}";
            EnumType     enumType          = new EnumType();

            enumType.Values.Add(new EnumValue()
            {
                Name = "A"
            });
            enumType.Values.Add(new EnumValue()
            {
                Name = "AAAA"
            });
            enumType.Values.Add(new EnumValue()
            {
                Name = "CNAME"
            });
            enumType.Values.Add(new EnumValue()
            {
                Name = "MX"
            });
            List <Parameter> methodParameters = new List <Parameter>()
            {
                new Parameter()
                {
                    Name = "recordType",
                    Type = enumType
                }
            };

            Assert.Equal(
                new string[]
            {
                "Microsoft.Network/dnszones/A",
                "Microsoft.Network/dnszones/AAAA",
                "Microsoft.Network/dnszones/CNAME",
                "Microsoft.Network/dnszones/MX"
            },
                ResourceSchemaParser.GetResourceTypes(provider, pathAfterProvider, methodParameters));
        }
示例#4
0
 public void GetResourceTypesWithMultipleLevelsOfResources()
 {
     Assert.Equal(new string[] { "Microsoft.Cdn/profiles/endpoints/customDomains" }, ResourceSchemaParser.GetResourceTypes("Microsoft.Cdn", "profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", new List <Parameter>()));
 }
示例#5
0
 public void GetResourceTypesWithOneLevelOfResources()
 {
     Assert.Equal(new string[] { "Microsoft.Cdn/profiles" }, ResourceSchemaParser.GetResourceTypes("Microsoft.Cdn", "profiles/{profileName}", new List <Parameter>()));
 }