@@ -55,6 +55,27 @@ public void OrderShouldNotMessWithAddTool()
5555 Assert . Equal ( "MyCustomDiffTool" , forExtension . Name ) ;
5656 }
5757
58+ [ Fact ]
59+ public void TextConvention ( )
60+ {
61+ var diffToolPath = FakeDiffTool . Exe ;
62+ var resolvedTool = DiffTools . AddTool (
63+ name : "MyCustomDiffTool" ,
64+ autoRefresh : true ,
65+ isMdi : false ,
66+ supportsText : true ,
67+ requiresTarget : true ,
68+ launchArguments : new (
69+ Left : ( tempFile , targetFile ) => $ "\" { targetFile } \" \" { tempFile } \" ",
70+ Right : ( tempFile , targetFile ) => $ "\" { tempFile } \" \" { targetFile } \" ") ,
71+ exePath : diffToolPath ,
72+ binaryExtensions : [ ] ) ! ;
73+ DiffTools . UseOrder ( DiffTool . VisualStudio , DiffTool . AraxisMerge ) ;
74+ Assert . Equal ( "MyCustomDiffTool" , resolvedTool . Name ) ;
75+ Assert . True ( DiffTools . TryFindByExtension ( ".txtConvention" , out var forExtension ) ) ;
76+ Assert . Equal ( "MyCustomDiffTool" , forExtension . Name ) ;
77+ }
78+
5879#if DEBUG
5980 [ Fact ]
6081 public void AddToolBasedOn ( )
@@ -129,6 +150,12 @@ public Task LaunchSpecificTextDiff() =>
129150 Path.Combine(SourceDirectory, "input.target.txt"));
130151 **/
131152
153+ [ Fact ]
154+ public Task TextFileConvention ( )
155+ {
156+ FileExtensions . AddTextFileConvention ( _ => _ . EndsWith ( ".txtConvention" . AsSpan ( ) ) ) ;
157+ return DiffRunner . LaunchAsync ( Path . Combine ( SourceDirectory , "input.temp.txtConvention" ) , Path . Combine ( SourceDirectory , "input.target.txtConvention" ) ) ;
158+ }
132159 //todo: re enable tests with fake diff tool.
133160
134161 /**
@@ -167,8 +194,7 @@ public void TryFindByName()
167194 }
168195#endif
169196**/
170- public DiffToolsTest ( ITestOutputHelper output )
171- :
197+ public DiffToolsTest ( ITestOutputHelper output ) :
172198 base ( output ) =>
173199 DiffTools . Reset ( ) ;
174200}
0 commit comments