Added testing for Shell and simple console app

pull/133/head
dahall 2020-06-06 19:21:28 -06:00
parent fd35f79e22
commit acdb6f845b
4 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Windows.Shell\Vanara.Windows.Shell.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
using System;
using Vanara.Windows.Shell;
using static Vanara.PInvoke.Shell32;
namespace CoreConsoleApp
{
class Program
{
[STAThread]
static void Main(string[] args)
{
using var computer = new ShellFolder(KNOWNFOLDERID.FOLDERID_ComputerFolder);
foreach (var si in computer)
{
Console.WriteLine(si.ParsingName);
si.Dispose();
}
foreach (var si in computer.EnumerateChildren(FolderItemFilter.Folders | FolderItemFilter.IncludeHidden | FolderItemFilter.IncludeSuperHidden | FolderItemFilter.NonFolders | FolderItemFilter.Printers | FolderItemFilter.FlatList))
{
Console.WriteLine(si.ParsingName);
si.Dispose();
}
}
}
}

View File

@ -6,7 +6,7 @@ using static Vanara.PInvoke.Shell32;
namespace Vanara.Windows.Shell.Tests
{
[TestFixture]
[TestFixture, SingleThreaded]
public class ShellFolderTests
{
private const string testFile = ShellItemTests.testDoc;
@ -94,6 +94,17 @@ namespace Vanara.Windows.Shell.Tests
Assert.That(() => new ShellFolder(KNOWNFOLDERID.FOLDERID_Windows).EnumerateChildren((FolderItemFilter)0x80000), Is.Empty);
}
[Test]
public void EnumComputerTest()
{
using var computer = new ShellFolder(KNOWNFOLDERID.FOLDERID_ComputerFolder);
foreach (var si in computer)
{
TestContext.WriteLine(si.ParsingName);
si.Dispose();
}
}
[Test]
public void GetDisplayNameTest()
{

View File

@ -229,6 +229,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.Graphics", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graphics", "UnitTests\PInvoke\Graphics\Graphics.csproj", "{AD003766-998F-4969-8632-A9CD0E3A21F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreConsoleApp", "UnitTests\CoreConsoleApp\CoreConsoleApp.csproj", "{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug (no Unit Tests)|Any CPU = Debug (no Unit Tests)|Any CPU
@ -736,6 +738,12 @@ Global
{AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD003766-998F-4969-8632-A9CD0E3A21F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD003766-998F-4969-8632-A9CD0E3A21F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Debug (no Unit Tests)|Any CPU.ActiveCfg = Debug|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Debug (no Unit Tests)|Any CPU.Build.0 = Debug|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -833,6 +841,7 @@ Global
{30F2727D-0B8E-4364-8F0E-9EEB4CD9CB0E} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{FAF09C42-66CA-4765-910A-2A9A2EF399D0} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{AD003766-998F-4969-8632-A9CD0E3A21F8} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
{3E14800D-4E2D-43A0-8C15-B64C6F4469CA} = {3EC6B40D-71D3-4E59-A0E0-544EC605FE11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}