mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Dev/crutkas/fixing warnings (#5161)
* new lines & braces * Tabs /space auto fix Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
@@ -79,7 +79,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
// Arrange
|
||||
PackageWrapper invalidPackagedApp = new PackageWrapper();
|
||||
Main._settings = new Settings();
|
||||
List<IPackage> packages = new List<IPackage>() {invalidPackagedApp };
|
||||
List<IPackage> packages = new List<IPackage>() { invalidPackagedApp };
|
||||
var mock = new Mock<IPackageManager>();
|
||||
mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages);
|
||||
UWP.PackageManagerWrapper = mock.Object;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
Name = "Command Prompt",
|
||||
ExecutableName = "cmd.exe",
|
||||
FullPath = "c:\\windows\\system32\\cmd.exe",
|
||||
LnkResolvedPath ="c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\system tools\\command prompt.lnk",
|
||||
LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\system tools\\command prompt.lnk",
|
||||
AppType = 2
|
||||
};
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
{
|
||||
//Arrange
|
||||
ListRepository<string> repository = new ListRepository<string>();
|
||||
var numItems = 1000;
|
||||
for(var i=0; i<numItems;++i)
|
||||
var numItems = 1000;
|
||||
for (var i = 0; i < numItems; ++i)
|
||||
{
|
||||
repository.Add($"OriginalItem_{i}");
|
||||
}
|
||||
@@ -87,16 +87,16 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
});
|
||||
|
||||
//Act - Insert on another thread
|
||||
var addTask = Task.Run(() =>
|
||||
{
|
||||
for (var i = 0; i < numItems; ++i)
|
||||
{
|
||||
repository.Add($"NewItem_{i}");
|
||||
}
|
||||
});
|
||||
var addTask = Task.Run(() =>
|
||||
{
|
||||
for (var i = 0; i < numItems; ++i)
|
||||
{
|
||||
repository.Add($"NewItem_{i}");
|
||||
}
|
||||
});
|
||||
|
||||
//Assert that this does not throw. Collections that aren't syncronized will throw an invalidoperatioexception if the list is modified while enumerating
|
||||
Assert.DoesNotThrowAsync(async () =>
|
||||
Assert.DoesNotThrowAsync(async () =>
|
||||
{
|
||||
await Task.WhenAll(new Task[] { iterationTask, addTask });
|
||||
});
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
// Arrange
|
||||
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32>>("Win32"), _settings, _pathsToWatch);
|
||||
|
||||
Win32 item1 = new Win32
|
||||
{
|
||||
Name = name,
|
||||
Win32 item1 = new Win32
|
||||
{
|
||||
Name = name,
|
||||
ExecutableName = exename,
|
||||
FullPath = fullPath,
|
||||
Description = description1
|
||||
@@ -108,7 +108,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
{
|
||||
// Arrange
|
||||
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32>>("Win32"), _settings, _pathsToWatch);
|
||||
RenamedEventArgs e = new RenamedEventArgs(WatcherChangeTypes.Renamed, directory , newpath, oldpath);
|
||||
RenamedEventArgs e = new RenamedEventArgs(WatcherChangeTypes.Renamed, directory, newpath, oldpath);
|
||||
|
||||
string oldFullPath = directory + "\\" + oldpath;
|
||||
string newFullPath = directory + "\\" + newpath;
|
||||
@@ -132,12 +132,12 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
// Arrange
|
||||
Win32ProgramRepository _win32ProgramRepository = new Win32ProgramRepository(_fileSystemWatchers, new BinaryStorage<IList<Win32>>("Win32"), _settings, _pathsToWatch);
|
||||
FileSystemEventArgs e = new FileSystemEventArgs(WatcherChangeTypes.Created, "directory", path);
|
||||
|
||||
|
||||
// FileVersionInfo must be mocked for exe applications
|
||||
var mockFileVersionInfo = new Mock<IFileVersionInfoWrapper>();
|
||||
mockFileVersionInfo.Setup(m => m.GetVersionInfo(It.IsAny<string>())).Returns((FileVersionInfo)null);
|
||||
Win32._fileVersionInfoWrapper = mockFileVersionInfo.Object;
|
||||
|
||||
|
||||
// Act
|
||||
_fileSystemMocks[0].Raise(m => m.Created += null, e);
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
|
||||
string oldFullPath = directory + "\\" + oldpath;
|
||||
string FullPath = directory + "\\" + path;
|
||||
|
||||
|
||||
// ShellLinkHelper must be mocked for lnk applications
|
||||
var mockShellLink = new Mock<IShellLinkHelper>();
|
||||
mockShellLink.Setup(m => m.RetrieveTargetPath(It.IsAny<string>())).Returns(String.Empty);
|
||||
|
||||
Reference in New Issue
Block a user