Skip to content

Commit

Permalink
Build fix for sshnet#396 of sshnet#395 : SftpClient Enumerates Rather…
Browse files Browse the repository at this point in the history
… Than Accumulates Directory Items
  • Loading branch information
znamenap committed Sep 1, 2020
1 parent f578c85 commit 57adbee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,27 @@ public void Test_Sftp_EnumerateDirectory_HugeDirectory()
{
sftp.CreateDirectory(string.Format("test_{0}", i));
}
Debug.WriteLine("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
Debug.WriteLine(string.Format("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));

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

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

sftp.Disconnect();
}
}
finally
{
stopwatch.Restart();
stopwatch.Reset(); stopwatch.Start();
RemoveAllFiles();
stopwatch.Stop();
Debug.WriteLine("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds);
Debug.WriteLine(string.Format("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds));
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,27 @@ public void Test_Sftp_ListDirectory_HugeDirectory()
{
sftp.CreateDirectory(string.Format("test_{0}", i));
}
Debug.WriteLine("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds);
Debug.WriteLine(string.Format("Created {0} directories within {1} seconds", count, stopwatch.Elapsed.TotalSeconds));

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

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

sftp.Disconnect();
}
}
finally
{
stopwatch.Restart();
stopwatch.Reset(); stopwatch.Start();
RemoveAllFiles();
stopwatch.Stop();
Debug.WriteLine("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds);
Debug.WriteLine(string.Format("Removed all files within {0} seconds", stopwatch.Elapsed.TotalSeconds));
}
}

Expand Down

0 comments on commit 57adbee

Please sign in to comment.