mirror of https://github.com/dahall/Vanara.git
Updated unit tests with changes to TestCaseSources class
parent
8a06335cd9
commit
67e344975f
|
@ -9,7 +9,7 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<AssemblyName>ExplorerBrowser</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
|
@ -129,6 +129,9 @@
|
|||
<Name>Vanara.Windows.Shell</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Microsoft.WindowsAPICodePack.Samples
|
|||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new ShellNamespaceTreeControlTestForm()); // ExplorerBrowserTestForm());
|
||||
Application.Run(new ExplorerBrowserTestForm()); //ShellNamespaceTreeControlTestForm());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,22 +20,7 @@
|
|||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.shellNamespaceTreeControl1 = new Vanara.Windows.Forms.ShellNamespaceTreeControl();
|
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
|
||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.splitter2 = new System.Windows.Forms.Splitter();
|
||||
this.log = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
/*
|
||||
//
|
||||
// shellNamespaceTreeControl1
|
||||
//
|
||||
|
@ -53,6 +38,22 @@
|
|||
this.shellNamespaceTreeControl1.ItemMouseClick += new System.EventHandler<Vanara.Windows.Forms.ShellNamespaceTreeControlItemMouseClickEventArgs>(this.shellNamespaceTreeControl1_ItemMouseClick);
|
||||
this.shellNamespaceTreeControl1.ItemMouseDoubleClick += new System.EventHandler<Vanara.Windows.Forms.ShellNamespaceTreeControlItemMouseClickEventArgs>(this.shellNamespaceTreeControl1_ItemMouseDoubleClick);
|
||||
this.shellNamespaceTreeControl1.AfterSelect += new System.EventHandler(this.shellNamespaceTreeControl1_SelectionChanged);
|
||||
*/
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
|
||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.splitter2 = new System.Windows.Forms.Splitter();
|
||||
this.log = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// propertyGrid1
|
||||
//
|
||||
|
@ -105,7 +106,6 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(729, 450);
|
||||
this.Controls.Add(this.shellNamespaceTreeControl1);
|
||||
this.Controls.Add(this.splitter1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "ShellNamespaceTreeControlTestForm";
|
||||
|
@ -119,7 +119,6 @@
|
|||
|
||||
#endregion
|
||||
|
||||
private Vanara.Windows.Forms.ShellNamespaceTreeControl shellNamespaceTreeControl1;
|
||||
private System.Windows.Forms.PropertyGrid propertyGrid1;
|
||||
private System.Windows.Forms.Splitter splitter1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
|
|
|
@ -22,14 +22,14 @@ namespace ExplorerBrowser
|
|||
private void ShellNamespaceTreeControlTestForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
using var qaPidl = new PIDL("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}");
|
||||
shellNamespaceTreeControl1.RootItems.Add(new ShellFolder(qaPidl), false, true);
|
||||
shellNamespaceTreeControl1.RootItems.Add(ShellFolder.Desktop, true, true);
|
||||
propertyGrid1.SelectedObject = shellNamespaceTreeControl1;
|
||||
//shellNamespaceTreeControl1.RootItems.Add(new ShellFolder(qaPidl), false, true);
|
||||
//shellNamespaceTreeControl1.RootItems.Add(ShellFolder.Desktop, true, true);
|
||||
//propertyGrid1.SelectedObject = shellNamespaceTreeControl1;
|
||||
}
|
||||
|
||||
private void shellNamespaceTreeControl1_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
log.AppendText("Selected item: " + shellNamespaceTreeControl1.SelectedItem?.Name ?? "[null]" + Environment.NewLine);
|
||||
//log.AppendText("Selected item: " + shellNamespaceTreeControl1.SelectedItem?.Name ?? "[null]" + Environment.NewLine);
|
||||
}
|
||||
|
||||
private void shellNamespaceTreeControl1_AfterExpand(object sender, Vanara.Windows.Forms.ShellNamespaceTreeControlEventArgs e)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
|
@ -17,7 +17,7 @@ namespace Vanara.PInvoke.Tests
|
|||
{
|
||||
const string imgName = "imagehlp.dll";
|
||||
const string testAppName = "TestDbgApp";
|
||||
const string testAppPath = TestCaseSources.TempDirWhack + testAppName + ".exe";
|
||||
static readonly string testAppPath = TestCaseSources.TempDirWhack + testAppName + ".exe";
|
||||
private Process testApp;
|
||||
private ProcessSymbolHandler hProc;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void CreateDirectoryTest()
|
||||
{
|
||||
const string dir = TestCaseSources.TempChildDir;
|
||||
string dir = TestCaseSources.TempChildDir;
|
||||
Assert.That(CreateDirectory(dir), Is.True);
|
||||
Assert.That(System.IO.Directory.Exists(dir), Is.True);
|
||||
Assert.That(RemoveDirectory(dir), Is.True);
|
||||
|
@ -113,7 +113,7 @@ namespace Vanara.PInvoke.Tests
|
|||
public void DefineDosDeviceTest()
|
||||
{
|
||||
const string src = "M:";
|
||||
const string target = TestCaseSources.TempDir;
|
||||
string target = TestCaseSources.TempDir;
|
||||
|
||||
var c = QueryDosDevice(src).ToArray().Length;
|
||||
Assert.That(DefineDosDevice(DDD.DDD_NO_BROADCAST_SYSTEM, src, target), Is.True);
|
||||
|
@ -176,7 +176,7 @@ namespace Vanara.PInvoke.Tests
|
|||
|
||||
void FileMaker()
|
||||
{
|
||||
const string fn = TestCaseSources.TempDir + @"\_tempFile.txt";
|
||||
string fn = TestCaseSources.TempDir + @"\_tempFile.txt";
|
||||
while (keepGoing)
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[TestFixture]
|
||||
public class Kernel32Tests
|
||||
{
|
||||
internal const string fn = TestCaseSources.SmallFile;
|
||||
internal static readonly string fn = TestCaseSources.SmallFile;
|
||||
internal const string tmpstr = @"Temporary";
|
||||
|
||||
public static string CreateTempFile(bool markAsTemp = true)
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace Vanara.PInvoke.Tests
|
|||
[TestFixture]
|
||||
public partial class WinBaseTests_File
|
||||
{
|
||||
private const string bigfn = TestCaseSources.LargeFile;
|
||||
private const string fn = TestCaseSources.SmallFile;
|
||||
private static readonly string bigfn = TestCaseSources.LargeFile;
|
||||
private static readonly string fn = TestCaseSources.SmallFile;
|
||||
private const string newfn = @"C:\Temp\help2.ico";
|
||||
|
||||
[Test]
|
||||
|
@ -105,7 +105,7 @@ namespace Vanara.PInvoke.Tests
|
|||
public void EnumVolumeMountPointsTest()
|
||||
{
|
||||
// Setup a new mount on C:
|
||||
const string mntDir = TestCaseSources.TempDirWhack + @"Mounted\";
|
||||
string mntDir = TestCaseSources.TempDirWhack + @"Mounted\";
|
||||
var sb = new StringBuilder(100);
|
||||
Assert.That(GetVolumeNameForVolumeMountPoint(@"C:\", sb, (uint)sb.Capacity), ResultIs.Successful);
|
||||
var cvol = sb.ToString();
|
||||
|
@ -167,7 +167,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void MoveFileExTest()
|
||||
{
|
||||
const string newFld = TestCaseSources.TempChildDir;
|
||||
string newFld = TestCaseSources.TempChildDir;
|
||||
Assert.That(MoveFileEx(fn, Path.Combine(newFld, Path.GetFileName(fn)), MOVEFILE.MOVEFILE_REPLACE_EXISTING), ResultIs.Successful);
|
||||
Assert.That(MoveFileEx(Path.Combine(newFld, Path.GetFileName(fn)), fn, MOVEFILE.MOVEFILE_REPLACE_EXISTING), ResultIs.Successful);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void MoveFileTest()
|
||||
{
|
||||
const string newFld = TestCaseSources.TempChildDir;
|
||||
string newFld = TestCaseSources.TempChildDir;
|
||||
Assert.That(MoveFile(fn, Path.Combine(newFld, Path.GetFileName(fn))), ResultIs.Successful);
|
||||
Assert.That(MoveFile(Path.Combine(newFld, Path.GetFileName(fn)), fn), ResultIs.Successful);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void MoveFileWithProgressTest()
|
||||
{
|
||||
const string newFld = TestCaseSources.TempChildDir;
|
||||
string newFld = TestCaseSources.TempChildDir;
|
||||
var qtr = 0;
|
||||
Assert.That(MoveFileWithProgress(bigfn, Path.Combine(newFld, Path.GetFileName(bigfn)), fProgress, default, MOVEFILE.MOVEFILE_REPLACE_EXISTING), ResultIs.Successful);
|
||||
Assert.That(MoveFileWithProgress(Path.Combine(newFld, Path.GetFileName(bigfn)), bigfn, fProgress, default, MOVEFILE.MOVEFILE_REPLACE_EXISTING), ResultIs.Successful);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[TestFixture]
|
||||
public partial class WinBaseTests_Resource
|
||||
{
|
||||
private const string ResExe = TestCaseSources.ResourceFile;
|
||||
private static readonly string ResExe = TestCaseSources.ResourceFile;
|
||||
private const int ResId1 = 103;
|
||||
private const int ResId2 = 129;
|
||||
private const int ResType = (int)ResourceType.RT_DIALOG;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Vanara.PInvoke.Tests
|
|||
public class AdvApi32Tests
|
||||
{
|
||||
internal const SECURITY_INFORMATION AllSI = SECURITY_INFORMATION.OWNER_SECURITY_INFORMATION | SECURITY_INFORMATION.GROUP_SECURITY_INFORMATION | SECURITY_INFORMATION.DACL_SECURITY_INFORMATION | SECURITY_INFORMATION.SACL_SECURITY_INFORMATION;
|
||||
internal const string fn = TestCaseSources.SmallFile;
|
||||
internal static readonly string fn = TestCaseSources.SmallFile;
|
||||
|
||||
[Test()]
|
||||
public void ConvertSecurityDescriptorToStringSecurityDescriptorTest()
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[TestFixture()]
|
||||
public partial class EvnTraceTests
|
||||
{
|
||||
private const string logfilePath = TestCaseSources.EventFile;
|
||||
private static readonly string logfilePath = TestCaseSources.EventFile;
|
||||
|
||||
[Test]
|
||||
public void EnumerateTraceGuidsTest()
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[TestFixture()]
|
||||
public class WinBase_EventLogTests
|
||||
{
|
||||
private const string eventLogName = TestCaseSources.LogFile;
|
||||
private static readonly string eventLogName = TestCaseSources.LogFile;
|
||||
|
||||
[Test]
|
||||
public void OpenBackupClearCloseEventLogTest()
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void ExtractAssociatedIconTest()
|
||||
{
|
||||
const string icoFile = TestCaseSources.WordDoc;
|
||||
string icoFile = TestCaseSources.WordDoc;
|
||||
var sb = new StringBuilder(icoFile, MAX_PATH);
|
||||
ushort iidx = 0;
|
||||
using (var hIcon = ExtractAssociatedIcon(HINSTANCE.NULL, sb, ref iidx))
|
||||
|
@ -26,7 +26,7 @@ namespace Vanara.PInvoke.Tests
|
|||
[Test]
|
||||
public void ExtractAssociatedIconExTest()
|
||||
{
|
||||
const string icoFile = TestCaseSources.WordDoc;
|
||||
string icoFile = TestCaseSources.WordDoc;
|
||||
var sb = new StringBuilder(icoFile, MAX_PATH);
|
||||
ushort iidx = 0, iid = 0;
|
||||
using (var hIcon = ExtractAssociatedIconEx(HINSTANCE.NULL, sb, ref iidx, ref iid))
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Vanara.IO.Tests
|
|||
[TestFixture()]
|
||||
public class VirtualDiskTests
|
||||
{
|
||||
const string tmpfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD.vhd";
|
||||
const string tmpcfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD - Diff.vhd";
|
||||
const string fn = Vanara.PInvoke.Tests.TestCaseSources.VirtualDisk;
|
||||
static readonly string tmpfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD.vhd";
|
||||
static readonly string tmpcfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD - Diff.vhd";
|
||||
static readonly string fn = Vanara.PInvoke.Tests.TestCaseSources.VirtualDisk;
|
||||
|
||||
[Test()]
|
||||
public void CreateDynPropTest()
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Vanara.Windows.Shell.Tests
|
|||
[TestFixture, SingleThreaded]
|
||||
public class ShellFolderTests
|
||||
{
|
||||
private const string testFile = ShellItemTests.testDoc;
|
||||
private static readonly string testFile = ShellItemTests.testDoc;
|
||||
private static readonly string testFld = Path.GetDirectoryName(testFile);
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Vanara.Windows.Shell.Tests
|
|||
[TestFixture]
|
||||
public class ShellItemPropStoreTests
|
||||
{
|
||||
private const string testDoc = ShellItemTests.testDoc;
|
||||
private static readonly string testDoc = ShellItemTests.testDoc;
|
||||
|
||||
[Test]
|
||||
public void DescriptionTest()
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace Vanara.Windows.Shell.Tests
|
|||
public class ShellItemTests
|
||||
{
|
||||
internal const string badTestDoc = @"C:\Temp\BadTest.doc";
|
||||
internal const string testDoc = PInvoke.Tests.TestCaseSources.WordDoc;
|
||||
internal const string testLinkDoc = PInvoke.Tests.TestCaseSources.WordDocLink;
|
||||
internal static readonly string testDoc = PInvoke.Tests.TestCaseSources.WordDoc;
|
||||
internal static readonly string testLinkDoc = PInvoke.Tests.TestCaseSources.WordDocLink;
|
||||
|
||||
[Test]
|
||||
public void EqualityTest()
|
||||
|
|
Loading…
Reference in New Issue