diff --git a/UnitTests/Windows.Shell/ShellItemTests.cs b/UnitTests/Windows.Shell/ShellItemTests.cs index 003f79aa..e764a8df 100644 --- a/UnitTests/Windows.Shell/ShellItemTests.cs +++ b/UnitTests/Windows.Shell/ShellItemTests.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Drawing; using System.Runtime.InteropServices.ComTypes; using Vanara.PInvoke; +using Vanara.PInvoke.Tests; using static Vanara.PInvoke.Ole32; using static Vanara.PInvoke.Shell32; @@ -220,5 +221,22 @@ namespace Vanara.Windows.Shell.Tests }, Throws.Nothing); Assert.That(() => new ShellItem(PIDL.Null), Throws.Exception); } + + [Test] + public void ToUriTest() + { + using var i = new ShellItem(testDoc); + var testDocUri = new Uri(testDoc); + Assert.That(testDocUri, Is.EqualTo(i.ToUri())); + + using var f = new ShellFolder(KNOWNFOLDERID.FOLDERID_ControlPanelFolder); + Assert.That(f.ToUri().ToString(), Is.EqualTo("shell:::" + KNOWNFOLDERID.FOLDERID_ControlPanelFolder.Guid().ToString("B"))); + + using var d = new ShellItem(Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\Documents\debug.log")); + Assert.That(d.ToUri().ToString(), Is.EqualTo("shell:::{f42ee2d3-909f-4907-8871-4c22fc0bf756}/debug.log")); + + using var td = new ShellItem(d.ToUri().ToString()); + td.FileSystemPath.WriteValues(); + } } } \ No newline at end of file diff --git a/UnitTests/Windows.Shell/ShellViewTests.cs b/UnitTests/Windows.Shell/ShellViewTests.cs new file mode 100644 index 00000000..0c67ee83 --- /dev/null +++ b/UnitTests/Windows.Shell/ShellViewTests.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using System; +using System.Runtime.InteropServices; +using System.Text; +using Vanara.InteropServices; +using Vanara.PInvoke; +using Vanara.PInvoke.Tests; +using static Vanara.PInvoke.Shell32; + +namespace Vanara.Windows.Shell.Tests +{ + [TestFixture] + public class ShelViewTests + { + [Test] + public void CreateTest() + { + var form = new System.Windows.Forms.Form() { Size = new System.Drawing.Size(200, 200) }; + // TODO: Finishing testing once working + //var shvw = new ShellView(new ShellFolder(TestCaseSources.TempDir)) { Dock = System.Windows.Forms.DockStyle.Fill }; + //form.Controls.Add(shvw); + form.ShowDialog(); + } + } +} \ No newline at end of file diff --git a/UnitTests/Windows.Shell/Windows.Shell.csproj b/UnitTests/Windows.Shell/Windows.Shell.csproj index f04021bb..7a8ff68a 100644 --- a/UnitTests/Windows.Shell/Windows.Shell.csproj +++ b/UnitTests/Windows.Shell/Windows.Shell.csproj @@ -51,6 +51,7 @@ +