@@ -554,7 +554,7 @@ public async Task HandlesLegacyLicenseUrlPackageAccordingToSettings(bool blockLe
554
554
Assert . Equal ( PackageValidationResultType . Accepted , result . Type ) ;
555
555
Assert . Null ( result . Message ) ;
556
556
Assert . Single ( result . Warnings ) ;
557
- Assert . StartsWith ( "<licenseUrl> element will be deprecated, please consider switching to specifying the license in the package ." , result . Warnings [ 0 ] . PlainTextMessage ) ;
557
+ Assert . StartsWith ( "The <licenseUrl> element is deprecated. Consider using the < license> element instead ." , result . Warnings [ 0 ] . PlainTextMessage ) ;
558
558
Assert . IsType < LicenseUrlDeprecationValidationMessage > ( result . Warnings [ 0 ] ) ;
559
559
}
560
560
}
@@ -1141,6 +1141,53 @@ public async Task AcceptsPackagesWithEmbeddedIconForFlightedUsers()
1141
1141
Assert . Empty ( result . Warnings ) ;
1142
1142
}
1143
1143
1144
+ [ Fact ]
1145
+ public async Task WarnsAboutPackagesWithIconUrlForFlightedUsers ( )
1146
+ {
1147
+ _nuGetPackage = GeneratePackageWithUserContent (
1148
+ iconUrl : new Uri ( "https://nuget.test/icon" ) ,
1149
+ iconFilename : null ,
1150
+ licenseExpression : "MIT" ,
1151
+ licenseUrl : new Uri ( "https://licenses.nuget.org/MIT" ) ) ;
1152
+ _featureFlagService
1153
+ . Setup ( ffs => ffs . AreEmbeddedIconsEnabled ( _currentUser ) )
1154
+ . Returns ( true ) ;
1155
+
1156
+ var result = await _target . ValidateBeforeGeneratePackageAsync (
1157
+ _nuGetPackage . Object ,
1158
+ GetPackageMetadata ( _nuGetPackage ) ,
1159
+ _currentUser ) ;
1160
+
1161
+ Assert . Equal ( PackageValidationResultType . Accepted , result . Type ) ;
1162
+ Assert . Null ( result . Message ) ;
1163
+ var warning = Assert . Single ( result . Warnings ) ;
1164
+ Assert . IsType < IconUrlDeprecationValidationMessage > ( warning ) ;
1165
+ Assert . StartsWith ( "The <iconUrl> element is deprecated. Consider using the <icon> element instead." , warning . PlainTextMessage ) ;
1166
+ Assert . StartsWith ( "The <iconUrl> element is deprecated. Consider using the <icon> element instead." , warning . RawHtmlMessage ) ;
1167
+ }
1168
+
1169
+ [ Fact ]
1170
+ public async Task DoesntWarnAboutPackagesWithIconUrl ( )
1171
+ {
1172
+ _nuGetPackage = GeneratePackageWithUserContent (
1173
+ iconUrl : new Uri ( "https://nuget.test/icon" ) ,
1174
+ iconFilename : null ,
1175
+ licenseExpression : "MIT" ,
1176
+ licenseUrl : new Uri ( "https://licenses.nuget.org/MIT" ) ) ;
1177
+ _featureFlagService
1178
+ . Setup ( ffs => ffs . AreEmbeddedIconsEnabled ( _currentUser ) )
1179
+ . Returns ( false ) ;
1180
+
1181
+ var result = await _target . ValidateBeforeGeneratePackageAsync (
1182
+ _nuGetPackage . Object ,
1183
+ GetPackageMetadata ( _nuGetPackage ) ,
1184
+ _currentUser ) ;
1185
+
1186
+ Assert . Equal ( PackageValidationResultType . Accepted , result . Type ) ;
1187
+ Assert . Null ( result . Message ) ;
1188
+ Assert . Empty ( result . Warnings ) ;
1189
+ }
1190
+
1144
1191
[ Theory ]
1145
1192
[ InlineData ( "<icon><something/></icon>" ) ]
1146
1193
[ InlineData ( "<icon><something>icon.png</something></icon>" ) ]
@@ -2218,6 +2265,7 @@ protected static Mock<TestPackageReader> GeneratePackageWithUserContent(
2218
2265
bool isSigned = true ,
2219
2266
int ? desiredTotalEntryCount = null ,
2220
2267
Func < string > getCustomNuspecNodes = null ,
2268
+ Uri iconUrl = null ,
2221
2269
Uri licenseUrl = null ,
2222
2270
string licenseExpression = null ,
2223
2271
string licenseFilename = null ,
@@ -2232,6 +2280,7 @@ protected static Mock<TestPackageReader> GeneratePackageWithUserContent(
2232
2280
isSigned : isSigned ,
2233
2281
desiredTotalEntryCount : desiredTotalEntryCount ,
2234
2282
getCustomNuspecNodes : getCustomNuspecNodes ,
2283
+ iconUrl : iconUrl ,
2235
2284
licenseUrl : licenseUrl ,
2236
2285
licenseExpression : licenseExpression ,
2237
2286
licenseFilename : licenseFilename ,
@@ -2249,6 +2298,7 @@ protected static MemoryStream GeneratePackageStream(
2249
2298
bool isSigned = true ,
2250
2299
int ? desiredTotalEntryCount = null ,
2251
2300
Func < string > getCustomNuspecNodes = null ,
2301
+ Uri iconUrl = null ,
2252
2302
Uri licenseUrl = null ,
2253
2303
string licenseExpression = null ,
2254
2304
string licenseFilename = null ,
@@ -2265,6 +2315,7 @@ protected static MemoryStream GeneratePackageStream(
2265
2315
desiredTotalEntryCount : desiredTotalEntryCount ,
2266
2316
getCustomNuspecNodes : getCustomNuspecNodes ,
2267
2317
licenseUrl : licenseUrl ,
2318
+ iconUrl : iconUrl ,
2268
2319
licenseExpression : licenseExpression ,
2269
2320
licenseFilename : licenseFilename ,
2270
2321
licenseFileContents : GetBinaryLicenseFileContents ( licenseFileBinaryContents , licenseFileContents ) ,
0 commit comments