@@ -91,6 +91,41 @@ public void ShouldReplaceAssemblyVersionWithStar()
91
91
{
92
92
const string expected = @"AssemblyVersion(""2.3.0.0"");
93
93
AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"");
94
+ AssemblyFileVersion(""2.3.1.0"");" ;
95
+ fileSystem . Received ( ) . WriteAllText ( "C:\\ Testing\\ AssemblyInfo.cs" , expected ) ;
96
+ }
97
+ }
98
+
99
+ [ Test ] public void ShouldReplaceAlreadySubstitutedValues ( )
100
+ {
101
+ var fileSystem = Substitute . For < IFileSystem > ( ) ;
102
+ var version = new SemanticVersion
103
+ {
104
+ BuildMetaData = new SemanticVersionBuildMetaData ( 3 , "foo" , "hash" , DateTimeOffset . Now ) ,
105
+ Major = 2 ,
106
+ Minor = 3 ,
107
+ Patch = 1
108
+ } ;
109
+
110
+ const string workingDir = "C:\\ Testing" ;
111
+ const string assemblyInfoFile = @"AssemblyVersion(""2.2.0.0"");
112
+ AssemblyInformationalVersion(""2.2.0+5.Branch.foo.Sha.hash"");
113
+ AssemblyFileVersion(""2.2.0.0"");" ;
114
+
115
+ fileSystem . Exists ( "C:\\ Testing\\ AssemblyInfo.cs" ) . Returns ( true ) ;
116
+ fileSystem . ReadAllText ( "C:\\ Testing\\ AssemblyInfo.cs" ) . Returns ( assemblyInfoFile ) ;
117
+
118
+ var config = new TestEffectiveConfiguration ( assemblyVersioningScheme : AssemblyVersioningScheme . MajorMinor ) ;
119
+ var variable = VariableProvider . GetVariablesFor ( version , config , false ) ;
120
+ var args = new Arguments
121
+ {
122
+ UpdateAssemblyInfo = true ,
123
+ UpdateAssemblyInfoFileName = "AssemblyInfo.cs"
124
+ } ;
125
+ using ( new AssemblyInfoFileUpdate ( args , workingDir , variable , fileSystem ) )
126
+ {
127
+ const string expected = @"AssemblyVersion(""2.3.0.0"");
128
+ AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"");
94
129
AssemblyFileVersion(""2.3.1.0"");" ;
95
130
fileSystem . Received ( ) . WriteAllText ( "C:\\ Testing\\ AssemblyInfo.cs" , expected ) ;
96
131
}
0 commit comments