@@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Tests.Creator.Te
21
21
[ Trait ( "Category" , "Tag Template Creation" ) ]
22
22
public class TagTemplateCreatorTests
23
23
{
24
- CreatorParameters GenerateCreatorParameters ( List < string > tagNames = null , List < string > apiTagNames = null )
24
+ CreatorParameters GenerateCreatorParameters ( List < string > tagNames = null , string apiTagNames = null )
25
25
{
26
26
var creatorConfig = new CreatorParameters ( ) ;
27
27
@@ -41,11 +41,10 @@ CreatorParameters GenerateCreatorParameters(List<string> tagNames = null, List<s
41
41
if ( ! apiTagNames . IsNullOrEmpty ( ) )
42
42
{
43
43
creatorConfig . Apis = new List < ApiConfig > ( ) ;
44
- var apiTagNamesString = string . Join ( "," , apiTagNames . ToArray ( ) ) ;
45
44
46
45
var apiConfig = new ApiConfig
47
46
{
48
- Tags = apiTagNamesString
47
+ Tags = apiTagNames
49
48
} ;
50
49
51
50
creatorConfig . Apis . Add ( apiConfig ) ;
@@ -54,20 +53,17 @@ CreatorParameters GenerateCreatorParameters(List<string> tagNames = null, List<s
54
53
return creatorConfig ;
55
54
}
56
55
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 )
59
60
{
60
61
var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
61
62
62
63
var tagNames = new List < string > ( )
63
64
{
64
65
"tag 1" , "tag2" , "tag 3" , "tag2"
65
66
} ;
66
- var apiTagNames = new List < string > ( )
67
- {
68
- "tag 1" , "tag2" , "api tag 3" , "api tag2"
69
- } ;
70
-
71
67
var creatorConfig = this . GenerateCreatorParameters ( tagNames , apiTagNames ) ;
72
68
73
69
var expectedTagsDictionary = new Dictionary < string , string > ( )
@@ -102,15 +98,12 @@ public void CreateTagTemplate_ShouldCreateTemplateFromCreatorConfig_GivenApiTags
102
98
}
103
99
}
104
100
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 )
107
105
{
108
106
var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
109
-
110
- var apiTagNames = new List < string > ( )
111
- {
112
- "tag 1" , "tag2" , "api tag 3" , "api tag2"
113
- } ;
114
107
var creatorConfig = this . GenerateCreatorParameters ( apiTagNames : apiTagNames ) ;
115
108
116
109
var expectedTagsDictionary = new Dictionary < string , string > ( )
@@ -164,16 +157,13 @@ public void CreateTagTemplate_ShouldThrowEmptyResourceNameAfterSanitizingErrorMe
164
157
{
165
158
var tagTemplateCreator = new TagTemplateCreator ( new TemplateBuilder ( ) ) ;
166
159
167
- var apiTagNames = new List < string > ( )
168
- {
169
- "tag 1" , "tag2" , "api tag 3" , " "
170
- } ;
160
+ var apiTagNames = "tag 1,tag2,api tag 3," ;
171
161
var creatorConfig = this . GenerateCreatorParameters ( apiTagNames : apiTagNames ) ;
172
162
173
163
174
164
//act & assert
175
165
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 ) ) ; ;
177
167
}
178
168
}
179
169
}
0 commit comments