From 7bb66d2182d9ab6c306f1ff36113d4291b6d2f9d Mon Sep 17 00:00:00 2001 From: Carlos Polop Date: Mon, 8 May 2023 17:20:30 +0200 Subject: [PATCH] Delete SearchHelperTests.cs --- winPEAS/winPEASexe/Tests/SearchHelperTests.cs | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 winPEAS/winPEASexe/Tests/SearchHelperTests.cs diff --git a/winPEAS/winPEASexe/Tests/SearchHelperTests.cs b/winPEAS/winPEASexe/Tests/SearchHelperTests.cs deleted file mode 100644 index ee602d9..0000000 --- a/winPEAS/winPEASexe/Tests/SearchHelperTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using winPEAS.Helpers; -using winPEAS.Helpers.Search; -using Path = Alphaleonis.Win32.Filesystem.Path; - - -namespace winPEAS.Tests -{ - [TestClass] - public class SearchHelperTests - { - [TestMethod] - public void TestGetFilesFastBypassesMAX_PATHLimit() - { - // Create a folder with files that have names longer than 260 characters - string folder = "C:\\Temp\\TestFolder"; - var createdirectory = new DirectoryInfo(folder); - createdirectory.Create(); - for (int i = 0; i < 10; i++) - { - string longName = new string('a', 300); - string fileName = Path.Combine(folder, $"{longName}_{i}.txt"); - - // Use the fsutil command to create a file with a long name - ProcessStartInfo startInfo = new ProcessStartInfo("fsutil", $"file createnew {fileName} 0") - { - UseShellExecute = true, - CreateNoWindow = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - ErrorDialog = true, - WindowStyle = ProcessWindowStyle.Normal - - }; - Process.Start(startInfo); - - } - - // Call the GetFilesFast method to get a list of all the files in the folder - List files = SearchHelper.GetFilesFast(folder); - - // Get a list of all the files in the folder using System.IO.Directory.GetFiles - string[] directoryFiles = System.IO.Directory.GetFiles(folder); - List expectedFiles = directoryFiles.Select(f => new FileInfo(f)).ToList(); - - // Make sure the lists have the same number of elements - Assert.AreEqual(expectedFiles.Count, files.Count); - - - } - } -} \ No newline at end of file