Fixed ProgId tests to work with 3.2.0

pull/119/head
dahall 2020-02-29 14:36:50 -07:00
parent 5f3030d012
commit 3ab6ea12b3
1 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ namespace Vanara.Windows.Shell.Tests
[Test] [Test]
public void ReadProgIDTest() public void ReadProgIDTest()
{ {
using (var pi = new ProgId("Word.Document.12")) using (var pi = ProgId.Open("Word.Document.12"))
{ {
Assert.That(pi.ReadOnly, Is.True); Assert.That(pi.ReadOnly, Is.True);
Assert.That(pi.DefaultIcon.ToString(), Is.EqualTo(@"C:\Program Files (x86)\Microsoft Office\Root\VFS\Windows\Installer\{90160000-000F-0000-0000-0000000FF1CE}\wordicon.exe,13")); Assert.That(pi.DefaultIcon.ToString(), Is.EqualTo(@"C:\Program Files (x86)\Microsoft Office\Root\VFS\Windows\Installer\{90160000-000F-0000-0000-0000000FF1CE}\wordicon.exe,13"));
@ -28,13 +28,13 @@ namespace Vanara.Windows.Shell.Tests
Assert.That(pi.Verbs["Close"], Is.Null); Assert.That(pi.Verbs["Close"], Is.Null);
//Assert.That(pi.Verbs["New"].DisplayName, Is.EqualTo("&New")); //Assert.That(pi.Verbs["New"].DisplayName, Is.EqualTo("&New"));
} }
using (var pi = new ProgId("Acrobat.Document.DC")) using (var pi = ProgId.Open("Acrobat.Document.DC"))
{ {
Assert.That(pi.EditFlags, Is.EqualTo(PInvoke.ShlwApi.FILETYPEATTRIBUTEFLAGS.FTA_OpenIsSafe)); Assert.That(pi.EditFlags, Is.EqualTo(PInvoke.ShlwApi.FILETYPEATTRIBUTEFLAGS.FTA_OpenIsSafe));
Assert.That(pi.CLSID, Is.EqualTo(new Guid("{B801CA65-A1FC-11D0-85AD-444553540000}"))); Assert.That(pi.CLSID, Is.EqualTo(new Guid("{B801CA65-A1FC-11D0-85AD-444553540000}")));
Assert.That(pi.Verbs["Print"].Command, Has.Length.GreaterThan(0)); Assert.That(pi.Verbs["Print"].Command, Has.Length.GreaterThan(0));
} }
using (var pi = new ProgId("CABFolder")) using (var pi = ProgId.Open("CABFolder"))
{ {
Assert.That(pi.EditFlags, Is.EqualTo(PInvoke.ShlwApi.FILETYPEATTRIBUTEFLAGS.FTA_SafeForElevation)); Assert.That(pi.EditFlags, Is.EqualTo(PInvoke.ShlwApi.FILETYPEATTRIBUTEFLAGS.FTA_SafeForElevation));
Assert.That(pi.FriendlyTypeName.ToString(), Is.EqualTo(@"@C:\WINDOWS\system32\cabview.dll,-20")); Assert.That(pi.FriendlyTypeName.ToString(), Is.EqualTo(@"@C:\WINDOWS\system32\cabview.dll,-20"));
@ -42,9 +42,9 @@ namespace Vanara.Windows.Shell.Tests
Assert.That(pi.InfoTip.ToString(), Is.EqualTo(@"@C:\WINDOWS\system32\cabview.dll,-21")); Assert.That(pi.InfoTip.ToString(), Is.EqualTo(@"@C:\WINDOWS\system32\cabview.dll,-21"));
Assert.That((pi.InfoTip as IndirectString)?.Value, Has.Length.GreaterThan(0)); Assert.That((pi.InfoTip as IndirectString)?.Value, Has.Length.GreaterThan(0));
} }
using (var pi = new ProgId("cdafile")) using (var pi = ProgId.Open("cdafile"))
Assert.That(pi.Verbs, Has.Count.EqualTo(0)); Assert.That(pi.Verbs, Has.Count.EqualTo(0));
using (var pi = new ProgId("Msi.Package")) using (var pi = ProgId.Open("Msi.Package"))
{ {
Assert.That(pi.Verbs, Has.Count.EqualTo(4)); Assert.That(pi.Verbs, Has.Count.EqualTo(4));
Assert.That(pi.Verbs.Order, Has.Count.EqualTo(4)); Assert.That(pi.Verbs.Order, Has.Count.EqualTo(4));
@ -58,9 +58,9 @@ namespace Vanara.Windows.Shell.Tests
const string sProgId = "My.Crazy.1"; const string sProgId = "My.Crazy.1";
const string testStr = "Testing123"; const string testStr = "Testing123";
ShellRegistrar.UnregisterProgID(sProgId); ProgId.Unregister(sProgId);
using (var progid = ShellRegistrar.RegisterProgID(sProgId, "Testing Vanara ProgId")) using (var progid = ProgId.Register(sProgId, "Testing Vanara ProgId"))
using (var reg = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(sProgId)) using (var reg = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(sProgId))
{ {
Assert.That(reg, Is.Not.Null); Assert.That(reg, Is.Not.Null);