public void FileDialog_RunDialog_ShowHelp_Success(bool result)
 {
     using var dialog = new SubFileDialog
           {
               ShowHelp = true
           };
     dialog.RunFileDialogAction = o =>
     {
         Assert.Equal(Marshal.SizeOf <NativeMethods.OPENFILENAME_I>(), o.lStructSize);
         Assert.Equal((IntPtr)1, o.hwndOwner);
         Assert.Equal(dialog.Instance, o.hInstance);
         Assert.Equal(" \0*.*\0\0", o.lpstrFilter);
         Assert.Equal(IntPtr.Zero, o.lpstrCustomFilter);
         Assert.Equal(0, o.nMaxCustFilter);
         Assert.Equal(1, o.nFilterIndex);
         Assert.NotEqual(IntPtr.Zero, o.lpstrFile);
         Assert.Equal(8192, o.nMaxFile);
         Assert.Equal(IntPtr.Zero, o.lpstrFileTitle);
         Assert.Equal(260, o.nMaxFileTitle);
         Assert.Null(o.lpstrInitialDir);
         Assert.Null(o.lpstrTitle);
         Assert.Equal(8914996, o.Flags);
         Assert.Equal(0, o.nFileOffset);
         Assert.Equal(0, o.nFileExtension);
         Assert.Null(o.lpstrDefExt);
         Assert.Equal(IntPtr.Zero, o.lCustData);
         Assert.NotNull(o.lpfnHook);
         Assert.Null(o.lpTemplateName);
         Assert.Equal(IntPtr.Zero, o.pvReserved);
         Assert.Equal(0, o.dwReserved);
         Assert.Equal(0, o.FlagsEx);
         return(result);
     };
     Assert.Equal(result, dialog.RunDialog((IntPtr)1));
 }
Beispiel #2
0
 public void FileDialog_RunDialog_NonVistaAdvanced_Success(bool result)
 {
     using var dialog = new SubFileDialog
           {
               AddExtension                 = result,
               AddToRecent                  = false,
               AutoUpgradeEnabled           = false,
               CheckFileExists              = true,
               CheckPathExists              = false,
               DefaultExt                   = "DefaultExt",
               DereferenceLinks             = false,
               FileName                     = "FileName",
               FilterIndex                  = 2,
               InitialDirectory             = "InitialDirectory",
               OkRequiresInteraction        = true,
               RestoreDirectory             = true,
               ShowHelp                     = true,
               ShowHiddenFiles              = true,
               ShowPinnedPlaces             = false,
               SupportMultiDottedExtensions = true,
               Tag           = "Tag",
               Title         = "Title",
               ValidateNames = false
           };
     dialog.RunFileDialogAction = o =>
     {
         Assert.Equal(Marshal.SizeOf <NativeMethods.OPENFILENAME_I>(), o.lStructSize);
         Assert.Equal((IntPtr)1, o.hwndOwner);
         Assert.Equal(dialog.Instance, o.hInstance);
         Assert.Null(o.lpstrFilter);
         Assert.Equal(IntPtr.Zero, o.lpstrCustomFilter);
         Assert.Equal(0, o.nMaxCustFilter);
         Assert.Equal(2, o.nFilterIndex);
         Assert.NotEqual(IntPtr.Zero, o.lpstrFile);
         Assert.Equal(8192, o.nMaxFile);
         Assert.Equal(IntPtr.Zero, o.lpstrFileTitle);
         Assert.Equal(260, o.nMaxFileTitle);
         Assert.Equal("InitialDirectory", o.lpstrInitialDir);
         Assert.Equal("Title", o.lpstrTitle);
         Assert.Equal(314310972, o.Flags);
         Assert.Equal(0, o.nFileOffset);
         Assert.Equal(0, o.nFileExtension);
         Assert.Equal(result ? "DefaultExt" : null, o.lpstrDefExt);
         Assert.Equal(IntPtr.Zero, o.lCustData);
         Assert.NotNull(o.lpfnHook);
         Assert.Null(o.lpTemplateName);
         Assert.Equal(IntPtr.Zero, o.pvReserved);
         Assert.Equal(0, o.dwReserved);
         Assert.Equal(0, o.FlagsEx);
         return(result);
     };
     Assert.Equal(result, dialog.RunDialog((IntPtr)1));
 }