@@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Tests.Creator.Te
2121 [ Trait ( "Category" , "Tag Template Creation" ) ]
2222 public class TagTemplateCreatorTests
2323 {
24- CreatorParameters GenerateCreatorParameters ( List < string > tagNames = null , List < string > apiTagNames = null )
24+ CreatorParameters GenerateCreatorParameters ( List < string > tagNames = null , string apiTagNames = null )
2525 {
2626 var creatorConfig = new CreatorParameters ( ) ;
2727
@@ -41,11 +41,10 @@ CreatorParameters GenerateCreatorParameters(List<string> tagNames = null, List<s
4141 if ( ! apiTagNames . IsNullOrEmpty ( ) )
4242 {
4343 creatorConfig . Apis = new List < ApiConfig > ( ) ;
44- var apiTagNamesString = string . Join ( "," , apiTagNames . ToArray ( ) ) ;
4544
4645 var apiConfig = new ApiConfig
4746 {
48- Tags = apiTagNamesString
47+ Tags = apiTagNames
4948 } ;
5049
5150 creatorConfig . Apis . Add ( apiConfig ) ;
@@ -54,20 +53,17 @@ CreatorParameters GenerateCreatorParameters(List<string> tagNames = null, List<s
5453 return creatorConfig ;
5554 }
5655
57- [ Fact ]
58- public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenApiTagsAndConfigTags ( )
56+ [ Theory ]
57+ [ InlineData ( "tag 1,tag2,api tag 3,api tag2" ) ]
58+ [ InlineData ( "tag 1, tag2, api tag 3, api tag2" ) ]
59+ public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenApiTagsAndConfigTags ( string apiTagNames )
5960 {
6061 var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
6162
6263 var tagNames = new List < string > ( )
6364 {
6465 "tag 1" , "tag2" , "tag 3" , "tag2"
6566 } ;
66- var apiTagNames = new List < string > ( )
67- {
68- "tag 1" , "tag2" , "api tag 3" , "api tag2"
69- } ;
70-
7167 var creatorConfig = this . GenerateCreatorParameters ( tagNames , apiTagNames ) ;
7268
7369 var expectedTagsDictionary = new Dictionary < string , string > ( )
@@ -102,15 +98,12 @@ public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenApiTags
10298 }
10399 }
104100
105- [ Fact ]
106- public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenOnlyApiTags ( )
101+ [ Theory ]
102+ [ InlineData ( "tag 1,tag2,api tag 3,api tag2" ) ]
103+ [ InlineData ( "tag 1, tag2, api tag 3, api tag2" ) ]
104+ public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenOnlyApiTags ( string apiTagNames )
107105 {
108106 var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
109-
110- var apiTagNames = new List < string > ( )
111- {
112- "tag 1" , "tag2" , "api tag 3" , "api tag2"
113- } ;
114107 var creatorConfig = this . GenerateCreatorParameters ( apiTagNames : apiTagNames ) ;
115108
116109 var expectedTagsDictionary = new Dictionary < string , string > ( )
@@ -164,16 +157,13 @@ public void CreateTagTemplate_ShouldThrowEmptyResourceNameAfterSanitizingErrorMe
164157 {
165158 var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
166159
167- var apiTagNames = new List < string > ( )
168- {
169- "tag 1" , "tag2" , "api tag 3" , " "
170- } ;
160+ var apiTagNames = "tag 1,tag2,api tag 3," ;
171161 var creatorConfig = this . GenerateCreatorParameters ( apiTagNames : apiTagNames ) ;
172162
173163
174164 //act & assert
175165 Action act = ( ) => tagTemplateCreator . CreateTagTemplate ( creatorConfig ) ;
176- act . Should ( ) . Throw < EmptyResourceNameException > ( ) . WithMessage ( string . Format ( ErrorMessages . EmptyResourceNameAfterSanitizingErrorMessage , " " ) ) ;
166+ act . Should ( ) . Throw < EmptyResourceNameException > ( ) . WithMessage ( string . Format ( ErrorMessages . EmptyResourceNameAfterSanitizingErrorMessage , string . Empty ) ) ; ;
177167 }
178168 }
179169}
0 commit comments