33using System . Linq ;
44using System . Text ;
55using System . Threading . Tasks ;
6+ using GitHub . Primitives ;
67using GitHub . Services ;
78using LibGit2Sharp ;
89using NUnit . Framework ;
@@ -61,7 +62,7 @@ public async Task One_File_Is_Modified(string content1, string content2)
6162
6263
6364 [ Test ]
64- public void Path_Must_Not_Use_Windows_Directory_Separator ( )
65+ public async Task Path_Can_Use_Windows_Directory_Separator ( )
6566 {
6667 using ( var temp = new TempRepository ( ) )
6768 {
@@ -72,8 +73,10 @@ public void Path_Must_Not_Use_Windows_Directory_Separator()
7273 var commit2 = AddCommit ( temp . Repository , path , newContent ) ;
7374 var target = new GitService ( new RepositoryFacade ( ) ) ;
7475
75- Assert . ThrowsAsync < ArgumentException > ( ( ) =>
76- target . Compare ( temp . Repository , commit1 . Sha , commit2 . Sha , path ) ) ;
76+ var patch = await target . Compare ( temp . Repository , commit1 . Sha , commit2 . Sha , path ) ;
77+
78+ var gitPath = Paths . ToGitPath ( path ) ;
79+ Assert . That ( patch . Count ( c => c . Path == gitPath ) , Is . EqualTo ( 1 ) ) ;
7780 }
7881 }
7982 }
@@ -134,7 +137,7 @@ public async Task Can_Handle_Renames(string oldPath, string oldContent, string n
134137 }
135138
136139 [ Test ]
137- public void Path_Must_Not_Use_Windows_Directory_Separator ( )
140+ public async Task Path_Can_Use_Windows_Directory_Separator ( )
138141 {
139142 using ( var temp = new TempRepository ( ) )
140143 {
@@ -146,8 +149,10 @@ public void Path_Must_Not_Use_Windows_Directory_Separator()
146149 var contentBytes = new UTF8Encoding ( false ) . GetBytes ( newContent ) ;
147150 var target = new GitService ( new RepositoryFacade ( ) ) ;
148151
149- Assert . ThrowsAsync < ArgumentException > ( ( ) =>
150- target . CompareWith ( temp . Repository , commit1 . Sha , commit2 . Sha , path , contentBytes ) ) ;
152+ var contentChanges = await target . CompareWith ( temp . Repository , commit1 . Sha , commit2 . Sha , path , contentBytes ) ;
153+
154+ Assert . That ( contentChanges . LinesAdded , Is . EqualTo ( 1 ) ) ;
155+ Assert . That ( contentChanges . LinesDeleted , Is . EqualTo ( 1 ) ) ;
151156 }
152157 }
153158 }
0 commit comments