@@ -50,19 +50,19 @@ public void It_respects_opt_outs(string attributeToOptOut)
50
50
. Should ( )
51
51
. Pass ( ) ;
52
52
53
- var expectedInfo = new SortedDictionary < string , string >
54
- {
55
- { "AssemblyInformationalVersionAttribute" , "1.2.3-beta" } ,
56
- { "AssemblyFileVersionAttribute" , "4.5.6.7" } ,
57
- { "AssemblyVersionAttribute" , "8.9.10.11" } ,
58
- { "AssemblyCompanyAttribute" , "TestCompany" } ,
59
- { "AssemblyConfigurationAttribute" , "Release" } ,
60
- { "AssemblyCopyrightAttribute" , "TestCopyright" } ,
61
- { "AssemblyDescriptionAttribute" , "TestDescription" } ,
62
- { "AssemblyProductAttribute" , "TestProduct" } ,
63
- { "AssemblyTitleAttribute" , "TestTitle" } ,
64
- { "AssemblyTrademarkAttribute" , "TestTrademark" } ,
65
- { "NeutralResourcesLanguageAttribute" , "fr" } ,
53
+ var expectedInfo = new HashSet < ( string Key , string Value ) >
54
+ {
55
+ ( "AssemblyInformationalVersionAttribute" , "1.2.3-beta" ) ,
56
+ ( "AssemblyFileVersionAttribute" , "4.5.6.7" ) ,
57
+ ( "AssemblyVersionAttribute" , "8.9.10.11" ) ,
58
+ ( "AssemblyCompanyAttribute" , "TestCompany" ) ,
59
+ ( "AssemblyConfigurationAttribute" , "Release" ) ,
60
+ ( "AssemblyCopyrightAttribute" , "TestCopyright" ) ,
61
+ ( "AssemblyDescriptionAttribute" , "TestDescription" ) ,
62
+ ( "AssemblyProductAttribute" , "TestProduct" ) ,
63
+ ( "AssemblyTitleAttribute" , "TestTitle" ) ,
64
+ ( "AssemblyTrademarkAttribute" , "TestTrademark" ) ,
65
+ ( "NeutralResourcesLanguageAttribute" , "fr" ) ,
66
66
} ;
67
67
68
68
if ( attributeToOptOut == "All" )
@@ -71,15 +71,15 @@ public void It_respects_opt_outs(string attributeToOptOut)
71
71
}
72
72
else
73
73
{
74
- expectedInfo . Remove ( attributeToOptOut ) ;
74
+ expectedInfo . RemoveWhere ( i => i . Key == attributeToOptOut ) ;
75
75
}
76
76
77
- expectedInfo . Add ( "TargetFrameworkAttribute" , $ ".NETCoreApp,Version=v{ ToolsetInfo . CurrentTargetFrameworkVersion } ") ;
77
+ expectedInfo . Add ( ( "TargetFrameworkAttribute" , $ ".NETCoreApp,Version=v{ ToolsetInfo . CurrentTargetFrameworkVersion } ") ) ;
78
78
79
79
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( ToolsetInfo . CurrentTargetFramework , "Release" ) . FullName , "HelloWorld.dll" ) ;
80
80
var actualInfo = AssemblyInfo . Get ( assemblyPath ) ;
81
81
82
- actualInfo . Should ( ) . Equal ( expectedInfo ) ;
82
+ actualInfo . Should ( ) . BeEquivalentTo ( expectedInfo ) ;
83
83
}
84
84
85
85
[ Fact ]
@@ -235,7 +235,7 @@ public void It_includes_source_revision_id_if_available__version_with_plus()
235
235
command . GetValues ( ) . Should ( ) . BeEquivalentTo ( new [ ] { "1.2.3+abc.xyz" } ) ;
236
236
}
237
237
238
- [ WindowsOnlyTheory ]
238
+ [ Theory ]
239
239
[ InlineData ( ToolsetInfo . CurrentTargetFramework ) ]
240
240
[ InlineData ( "net45" ) ]
241
241
public void It_respects_version_prefix ( string targetFramework )
@@ -258,9 +258,9 @@ public void It_respects_version_prefix(string targetFramework)
258
258
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( targetFramework ) . FullName , "HelloWorld.dll" ) ;
259
259
var info = AssemblyInfo . Get ( assemblyPath ) ;
260
260
261
- info [ "AssemblyVersionAttribute" ] . Should ( ) . Be ( " 1.2.3.0") ;
262
- info [ "AssemblyFileVersionAttribute" ] . Should ( ) . Be ( " 1.2.3.0") ;
263
- info [ "AssemblyInformationalVersionAttribute" ] . Should ( ) . Be ( " 1.2.3") ;
261
+ info . Should ( ) . Contain ( ( "AssemblyVersionAttribute" , " 1.2.3.0") ) ;
262
+ info . Should ( ) . Contain ( ( "AssemblyFileVersionAttribute" , " 1.2.3.0") ) ;
263
+ info . Should ( ) . Contain ( ( "AssemblyInformationalVersionAttribute" , " 1.2.3") ) ;
264
264
}
265
265
266
266
[ WindowsOnlyTheory ]
@@ -285,7 +285,7 @@ public void It_respects_version_changes_on_incremental_build(string targetFramew
285
285
// Then the version of the built assembly shall match the provided VersionPrefix
286
286
var assemblyPath = Path . Combine ( incrementalBuildCommand . GetOutputDirectory ( targetFramework ) . FullName , "HelloWorld.dll" ) ;
287
287
var info = AssemblyInfo . Get ( assemblyPath ) ;
288
- info [ "AssemblyVersionAttribute" ] . Should ( ) . Be ( " 1.2.4.0") ;
288
+ info . Should ( ) . Contain ( ( "AssemblyVersionAttribute" , " 1.2.4.0") ) ;
289
289
290
290
BuildCommand BuildProject ( string versionPrefix )
291
291
{
@@ -307,7 +307,7 @@ public void It_respects_custom_assembly_attribute_items_on_incremental_build()
307
307
308
308
var firstBuildCommand = BuildProject ( buildNumber : "1" ) ;
309
309
var assemblyPath = Path . Combine ( firstBuildCommand . GetOutputDirectory ( targetFramework ) . FullName , "TestLibrary.dll" ) ;
310
- AssemblyInfo . Get ( assemblyPath ) [ "AssemblyMetadataAttribute" ] . Should ( ) . Be ( " BuildNumber:1") ;
310
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "AssemblyMetadataAttribute" , " BuildNumber:1") ) ;
311
311
312
312
var firstWriteTime = File . GetLastWriteTimeUtc ( assemblyPath ) ;
313
313
@@ -324,7 +324,7 @@ public void It_respects_custom_assembly_attribute_items_on_incremental_build()
324
324
File . GetLastWriteTimeUtc ( assemblyPath ) . Should ( ) . NotBe ( firstWriteTime ) ;
325
325
326
326
// and the custom assembly should be generated with the updated value.
327
- AssemblyInfo . Get ( assemblyPath ) [ "AssemblyMetadataAttribute" ] . Should ( ) . Be ( " BuildNumber:2") ;
327
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "AssemblyMetadataAttribute" , " BuildNumber:2") ) ;
328
328
329
329
BuildCommand BuildProject ( string buildNumber )
330
330
{
@@ -358,7 +358,7 @@ public void It_includes_internals_visible_to()
358
358
359
359
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
360
360
361
- AssemblyInfo . Get ( assemblyPath ) [ "InternalsVisibleToAttribute" ] . Should ( ) . Be ( " Tests") ;
361
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "InternalsVisibleToAttribute" , " Tests") ) ;
362
362
}
363
363
364
364
[ RequiresMSBuildVersionTheory ( "17.0.0.32901" ) ]
@@ -552,7 +552,7 @@ public void It_respects_out_out_of_internals_visible_to()
552
552
553
553
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
554
554
555
- Assert . False ( AssemblyInfo . Get ( assemblyPath ) . ContainsKey ( "InternalsVisibleToAttribute" ) ) ;
555
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . NotContain ( i => i . Key == "InternalsVisibleToAttribute" ) ;
556
556
}
557
557
558
558
[ Fact ]
@@ -578,7 +578,7 @@ public void It_includes_internals_visible_to_with_key()
578
578
579
579
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
580
580
581
- AssemblyInfo . Get ( assemblyPath ) [ "InternalsVisibleToAttribute" ] . Should ( ) . Be ( " Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001d3e6bbb36e11ea61ceff6e1022b23dd779fc6230838db2d25a2c7c8433b3fcf86b16c25b281fc3db1027c0675395e7d0548e6add88b6a811962bf958101fa9e243b1618313bee11f5e3b3fefda7b1d1226311b6cc2d07e87ff893ba6890b20082df34a0aac14b605b8be055e81081a626f8c69e9ed4bbaa4eae9f94a35accd2") ;
581
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "InternalsVisibleToAttribute" , " Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001d3e6bbb36e11ea61ceff6e1022b23dd779fc6230838db2d25a2c7c8433b3fcf86b16c25b281fc3db1027c0675395e7d0548e6add88b6a811962bf958101fa9e243b1618313bee11f5e3b3fefda7b1d1226311b6cc2d07e87ff893ba6890b20082df34a0aac14b605b8be055e81081a626f8c69e9ed4bbaa4eae9f94a35accd2") ) ;
582
582
}
583
583
584
584
[ Fact ]
@@ -605,7 +605,7 @@ public void It_includes_internals_visible_to_with_project_publickey()
605
605
606
606
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
607
607
608
- AssemblyInfo . Get ( assemblyPath ) [ "InternalsVisibleToAttribute" ] . Should ( ) . Be ( " Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001d3e6bbb36e11ea61ceff6e1022b23dd779fc6230838db2d25a2c7c8433b3fcf86b16c25b281fc3db1027c0675395e7d0548e6add88b6a811962bf958101fa9e243b1618313bee11f5e3b3fefda7b1d1226311b6cc2d07e87ff893ba6890b20082df34a0aac14b605b8be055e81081a626f8c69e9ed4bbaa4eae9f94a35accd2") ;
608
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "InternalsVisibleToAttribute" , " Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001d3e6bbb36e11ea61ceff6e1022b23dd779fc6230838db2d25a2c7c8433b3fcf86b16c25b281fc3db1027c0675395e7d0548e6add88b6a811962bf958101fa9e243b1618313bee11f5e3b3fefda7b1d1226311b6cc2d07e87ff893ba6890b20082df34a0aac14b605b8be055e81081a626f8c69e9ed4bbaa4eae9f94a35accd2") ) ;
609
609
}
610
610
611
611
[ Fact ]
@@ -631,11 +631,11 @@ public void It_includes_assembly_metadata()
631
631
632
632
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
633
633
634
- AssemblyInfo . Get ( assemblyPath ) [ "AssemblyMetadataAttribute" ] . Should ( ) . Be ( " MetadataKey:MetadataValue") ;
634
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "AssemblyMetadataAttribute" , " MetadataKey:MetadataValue") ) ;
635
635
}
636
636
637
637
[ Fact ]
638
- public void It_respects_out_out_of_assembly_metadata ( )
638
+ public void It_respects_opt_out_of_assembly_metadata ( )
639
639
{
640
640
var testAsset = _testAssetsManager
641
641
. CopyTestAsset ( "HelloWorld" )
@@ -659,7 +659,7 @@ public void It_respects_out_out_of_assembly_metadata()
659
659
660
660
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( "netstandard2.0" ) . FullName , "HelloWorld.dll" ) ;
661
661
662
- Assert . False ( AssemblyInfo . Get ( assemblyPath ) . ContainsKey ( "AssemblyMetadataAttribute" ) ) ;
662
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . NotContain ( i => i . Key == "AssemblyMetadataAttribute" ) ;
663
663
}
664
664
665
665
[ Theory ]
@@ -699,11 +699,11 @@ public void GenerateUserSecrets(bool referenceAspNetCore, bool referenceExtensio
699
699
700
700
if ( shouldHaveAttribute )
701
701
{
702
- AssemblyInfo . Get ( assemblyPath ) [ "UserSecretsIdAttribute" ] . Should ( ) . Be ( " SecretsIdValue") ;
702
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "UserSecretsIdAttribute" , " SecretsIdValue") ) ;
703
703
}
704
704
else
705
705
{
706
- AssemblyInfo . Get ( assemblyPath ) . Should ( ) . NotContainKey ( "SecretsIdValue" ) ;
706
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . NotContain ( i => i . Key == "SecretsIdValue" ) ;
707
707
}
708
708
}
709
709
@@ -743,7 +743,7 @@ public void GenerateUserSecretsForTestProject()
743
743
744
744
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( testTestProject . TargetFrameworks ) . FullName , testTestProject . Name + ".dll" ) ;
745
745
746
- AssemblyInfo . Get ( assemblyPath ) [ "UserSecretsIdAttribute" ] . Should ( ) . Be ( " SecretsIdValue") ;
746
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "UserSecretsIdAttribute" , " SecretsIdValue") ) ;
747
747
}
748
748
749
749
[ Theory ]
@@ -775,7 +775,7 @@ public void It_includes_repository_url(bool privateRepo)
775
775
776
776
var assemblyPath = Path . Combine ( buildCommand . GetOutputDirectory ( testProject . TargetFrameworks ) . FullName , testProject . Name + ".dll" ) ;
777
777
778
- AssemblyInfo . Get ( assemblyPath ) [ "AssemblyMetadataAttribute" ] . Should ( ) . Be ( " RepositoryUrl:" + fakeUrl ) ;
778
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "AssemblyMetadataAttribute" , " RepositoryUrl:" + fakeUrl ) ) ;
779
779
}
780
780
781
781
[ Theory ]
@@ -804,11 +804,11 @@ public void It_does_not_write_to_undefined_assembly_metadata_attribute(string ta
804
804
805
805
if ( containsAttribute )
806
806
{
807
- AssemblyInfo . Get ( assemblyPath ) [ "AssemblyMetadataAttribute" ] . Should ( ) . Be ( " RepositoryUrl:" + fakeUrl ) ;
807
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . Contain ( ( "AssemblyMetadataAttribute" , " RepositoryUrl:" + fakeUrl ) ) ;
808
808
}
809
809
else
810
810
{
811
- AssemblyInfo . Get ( assemblyPath ) . ContainsKey ( "AssemblyMetadataAttribute" ) . Should ( ) . Be ( false ) ;
811
+ AssemblyInfo . Get ( assemblyPath ) . Should ( ) . NotContain ( i => i . Key == "AssemblyMetadataAttribute" ) ;
812
812
}
813
813
}
814
814
0 commit comments