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); }); }
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); }); }
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)); }
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>())); }
public void GetResourceTypesWithOneLevelOfResources() { Assert.Equal(new string[] { "Microsoft.Cdn/profiles" }, ResourceSchemaParser.GetResourceTypes("Microsoft.Cdn", "profiles/{profileName}", new List <Parameter>())); }