/// <summary> /// Helper method to determine if an IDataObject is valid /// for dropping on the tree view. It must be a the drop /// of a single file with a valid assembly file type. /// </summary> /// <param name="data">IDataObject to be tested</param> /// <returns>True if dropping is allowed</returns> private bool IsValidFileDrop(IDataObject data) { if (!data.GetDataPresent(DataFormats.FileDrop)) { return(false); } string [] fileNames = data.GetData(DataFormats.FileDrop) as string []; if (fileNames == null || fileNames.Length == 0) { return(false); } // We can't open more than one project at a time if (fileNames.Length == 1) { if (NUnitProject.IsProjectFile(fileNames[0])) { return(true); } if (UserSettings.Options.VisualStudioSupport) { if (VSProject.IsProjectFile(fileNames[0]) || VSProject.IsSolutionFile(fileNames[0])) { return(true); } } } // Multiple assemblies are allowed - we // assume they are all in the same directory // since they are being dragged together. foreach (string fileName in fileNames) { if (!ProjectPath.IsAssemblyFileType(fileName)) { return(false); } } return(true); }
public void IsAssemblyFileType() { Assert.IsTrue(ProjectPath.IsAssemblyFileType(@"c:\bin\test.dll")); Assert.IsTrue(ProjectPath.IsAssemblyFileType(@"test.exe")); Assert.IsFalse(ProjectPath.IsAssemblyFileType(@"c:\bin\test.nunit")); }