diff --git a/DokanNet.Tests/BufferPoolTests.cs b/DokanNet.Tests/BufferPoolTests.cs
new file mode 100644
index 00000000..d6bcbda3
--- /dev/null
+++ b/DokanNet.Tests/BufferPoolTests.cs
@@ -0,0 +1,51 @@
+using System;
+using DokanNet.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DokanNet.Tests
+{
+ ///
+ /// Tests for .
+ ///
+ [TestClass]
+ public sealed class BufferPoolTests
+ {
+ ///
+ /// Rudimentary test for .
+ ///
+ [TestMethod, TestCategory(TestCategories.Success)]
+ public void BufferPoolBasicTest()
+ {
+ BufferPool pool = new BufferPool();
+ ILogger logger = new ConsoleLogger();
+
+ // Verify buffer is pooled.
+ const int MB = 1024 * 1024;
+ byte[] buffer = pool.RentBuffer(MB, logger);
+ pool.ReturnBuffer(buffer, logger);
+
+ byte[] buffer2 = pool.RentBuffer(MB, logger);
+ Assert.AreSame(buffer, buffer2, "Expected recycling of 1 MB buffer.");
+
+ // Verify buffer that buffer not power of 2 is not pooled.
+ buffer = pool.RentBuffer(MB - 1, logger);
+ pool.ReturnBuffer(buffer, logger);
+
+ buffer2 = pool.RentBuffer(MB - 1, logger);
+ Assert.AreNotSame(buffer, buffer2, "Did not expect recycling of 1 MB - 1 byte buffer.");
+
+ // Run through a bunch of random buffer sizes and make sure we always get a buffer of the right size.
+ int seed = Environment.TickCount;
+ Console.WriteLine($"Random seed: {seed}");
+ Random random = new Random(seed);
+
+ for (int i = 0; i < 1000; i++)
+ {
+ int size = random.Next(0, 2 * MB);
+ buffer = pool.RentBuffer((uint)size, logger);
+ Assert.AreEqual(size, buffer.Length, "Wrong buffer size.");
+ pool.ReturnBuffer(buffer, logger);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/DokanNet.Tests/DirectoryInfoTest.cs b/DokanNet.Tests/DirectoryInfoTest.cs
index 5df027aa..d75ccd85 100644
--- a/DokanNet.Tests/DirectoryInfoTest.cs
+++ b/DokanNet.Tests/DirectoryInfoTest.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
@@ -338,13 +339,12 @@ public void Delete_WhereRecurseIsFalse_CallsApiCorrectly()
#endif
}
- [TestMethod, TestCategory(TestCategories.Success)]
- [DeploymentItem("DirectoryInfoTests.Configuration.xml")]
- [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\DirectoryInfoTests.Configuration.xml", "ConfigFindFiles", DataAccessMethod.Sequential)]
- public void Delete_WhereRecurseIsTrueAndDirectoryIsNonempty_CallsApiCorrectly()
- {
- var supportsPatternSearch = bool.Parse((string) TestContext.DataRow["SupportsPatternSearch"]);
+ public static IEnumerable