@@ -25,8 +25,9 @@ internal class Fixer
2525 </specFlow>" ;
2626
2727 private readonly string _specFlowExe ;
28+ private FileInfo [ ] featureFiles ;
2829
29- public Fixer ( )
30+ public Fixer ( )
3031 {
3132 // For full .NET Framework, you can get the user profile with: Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
3233 // This isn't available yet in .NET Core, so rely on the environment variable for now.
@@ -43,14 +44,27 @@ public Fixer()
4344 public void Fix ( DirectoryInfo directory )
4445 {
4546 WriteLine ( "Current directory: " + directory ) ;
46- var xproj = GetXproj ( directory ) ;
47+ featureFiles = directory . GetFiles ( "*.feature" , SearchOption . AllDirectories ) ;
48+ var generatedFileExists = featureFiles . Where ( f => ! File . Exists ( f . FullName + ".cs" ) ) . ToList ( ) ;
49+
50+ var xproj = GetXproj ( directory ) ;
4751 var fakeCsproj = SaveFakeCsProj ( directory , xproj ) ;
4852 GenerateSpecFlowGlue ( directory , fakeCsproj ) ;
4953 DeleteFakeCsProj ( fakeCsproj ) ;
5054 FixXunit ( directory ) ;
51- }
5255
53- private void DeleteFakeCsProj ( FileInfo fakeCsproj )
56+ if ( generatedFileExists . Any ( ) ) {
57+ generatedFileExists . ForEach ( WarnNotExists ) ;
58+ WriteLine ( "Rebuild to make the above files discoverable" ) ;
59+ }
60+ }
61+
62+ private void WarnNotExists ( FileInfo featureFile )
63+ {
64+ WriteLine ( $@ "New file generated: { featureFile . FullName } .cs. No tests in { featureFile . Name } will be discovered by dotnet test") ;
65+ }
66+
67+ private void DeleteFakeCsProj ( FileInfo fakeCsproj )
5468 {
5569 WriteLine ( "Removing: " + fakeCsproj . FullName ) ;
5670 fakeCsproj . Delete ( ) ;
@@ -171,7 +185,7 @@ private void DeleteSpecFlowConfig(string configPath)
171185
172186 private void GenerateSpecFlowGlue ( DirectoryInfo directory , FileInfo fakeCsproj )
173187 {
174- var appConfigPath = EnsureAppConfig ( directory ) ;
188+ var appConfigPath = EnsureAppConfig ( directory ) ;
175189 ValidateAppConfig ( appConfigPath ) ;
176190 var specFlowConfigPath = SaveSpecFlowConfig ( ) ;
177191 RunSpecFlow ( fakeCsproj . Name ) ;
@@ -182,7 +196,6 @@ private FileInfo SaveFakeCsProj(DirectoryInfo directory, FileInfo xproj)
182196 {
183197 WriteLine ( "Generating fake csproj." ) ;
184198
185- var featureFiles = directory . GetFiles ( "*.feature" , SearchOption . AllDirectories ) ;
186199 var sb = new StringBuilder ( ) ;
187200
188201 // Set the "ToolsVersion" to VS2013, see: https://github.com/techtalk/SpecFlow/issues/471
0 commit comments