Пример #1
0
 public void ReadProgIDTest()
 {
     using (var pi = ProgId.Open("Word.Document.12"))
     {
         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.AllowSilentDefaultTakeOver, Is.False);
         Assert.That(pi.AppUserModelID, Is.Null);
         Assert.That(pi.EditFlags, Is.EqualTo(PInvoke.ShlwApi.FILETYPEATTRIBUTEFLAGS.FTA_None));
         Assert.That(pi.Verbs, Has.Count.EqualTo(8));
         Assert.That(pi.Verbs["Close"], Is.Null);
         //Assert.That(pi.Verbs["New"].DisplayName, Is.EqualTo("&New"));
     }
     using (var pi = ProgId.Open("Acrobat.Document.DC"))
     {
         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.Verbs["Print"].Command, Has.Length.GreaterThan(0));
     }
     using (var pi = ProgId.Open("CABFolder"))
     {
         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.Value, Has.Length.GreaterThan(0));
         Assert.That(pi.InfoTip.ToString(), Is.EqualTo(@"@C:\WINDOWS\system32\cabview.dll,-21"));
         Assert.That((pi.InfoTip as IndirectString)?.Value, Has.Length.GreaterThan(0));
     }
     using (var pi = ProgId.Open("cdafile"))
         Assert.That(pi.Verbs, Has.Count.EqualTo(0));
     using (var pi = ProgId.Open("Msi.Package"))
     {
         Assert.That(pi.Verbs, Has.Count.EqualTo(4));
         Assert.That(pi.Verbs.Order, Has.Count.EqualTo(4));
         Assert.That(pi.Verbs.Order[3].Name, Is.EqualTo("runasuser"));
     }
 }