Skip to content

Commit 57adbee

Browse files
committed
Build fix for #396 of #395 : SftpClient Enumerates Rather Than Accumulates Directory Items
1 parent f578c85 commit 57adbee

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/Renci.SshNet.Tests/Classes/SftpClientTest.EnumerateDirectory.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,27 @@ public void Test_Sftp_EnumerateDirectory_HugeDirectory()
155155
{
156156
sftp.CreateDirectory(string.Format("test_{0}", i));
157157
}
158-
Debug.WriteLine("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
158+
Debug.WriteLine(string.Format("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));
159159

160-
stopwatch.Restart();
160+
stopwatch.Reset(); stopwatch.Start();
161161
var files = sftp.EnumerateDirectory(".");
162-
Debug.WriteLine("Listed {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
162+
Debug.WriteLine(string.Format("Listed {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));
163163

164164
// Ensure that directory has at least 10000 items
165-
stopwatch.Restart();
165+
stopwatch.Reset(); stopwatch.Start();
166166
var actualCount = files.Count();
167-
Assert.IsTrue(actualCount >= 10000);
168-
Debug.WriteLine("Used {0} items within {1} seconds", actualCount, stopwatch.Elapsed.TotalSeconds);
167+
Assert.IsTrue(actualCount >= count);
168+
Debug.WriteLine(string.Format("Used {0} items within {1} seconds", actualCount, stopwatch.Elapsed.TotalSeconds));
169169

170170
sftp.Disconnect();
171171
}
172172
}
173173
finally
174174
{
175-
stopwatch.Restart();
175+
stopwatch.Reset(); stopwatch.Start();
176176
RemoveAllFiles();
177177
stopwatch.Stop();
178-
Debug.WriteLine("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds);
178+
Debug.WriteLine(string.Format("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds));
179179
}
180180
}
181181

src/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,27 @@ public void Test_Sftp_ListDirectory_HugeDirectory()
154154
{
155155
sftp.CreateDirectory(string.Format("test_{0}", i));
156156
}
157-
Debug.WriteLine("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
157+
Debug.WriteLine(string.Format("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));
158158

159-
stopwatch.Restart();
159+
stopwatch.Reset(); stopwatch.Start();
160160
var files = sftp.ListDirectory(".");
161-
Debug.WriteLine("Listed {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
161+
Debug.WriteLine(string.Format("Listed {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));
162162

163163
// Ensure that directory has at least 10000 items
164-
stopwatch.Restart();
164+
stopwatch.Reset(); stopwatch.Start();
165165
var actualCount = files.Count();
166-
Assert.IsTrue(actualCount >= 10000);
167-
Debug.WriteLine("Used {0} items within {1} seconds", actualCount, stopwatch.Elapsed.TotalSeconds);
166+
Assert.IsTrue(actualCount >= count);
167+
Debug.WriteLine(string.Format("Used {0} items within {1} seconds", actualCount, stopwatch.Elapsed.TotalSeconds));
168168

169169
sftp.Disconnect();
170170
}
171171
}
172172
finally
173173
{
174-
stopwatch.Restart();
174+
stopwatch.Reset(); stopwatch.Start();
175175
RemoveAllFiles();
176176
stopwatch.Stop();
177-
Debug.WriteLine("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds);
177+
Debug.WriteLine(string.Format("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds));
178178
}
179179
}
180180

0 commit comments

Comments
 (0)