public void FullPath_ValidPath_ShouldBeFine() { using (TemporaryDirectory directory = new TemporaryDirectory()) { var expectations = new ExpectationCollection <string, string>(); // Ensure the path is always normalized properly. string rootTempPath = Path.GetFullPath(FileIO.GetRootTemporaryDirectory()).ToUpperInvariant(); // Note: These relative paths work properly because the unit test temporary directories are always // created as a subfolder off the AppDomain.CurrentDomain.BaseDirectory. expectations.Add(".", Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".")).ToUpperInvariant()); expectations.Add(FileIO.RootTemporaryDirectoryName, rootTempPath); expectations.Add(FileIO.GetRootTemporaryDirectory(), rootTempPath); expectations.Add(directory.DirectoryPath, Path.GetFullPath(directory.DirectoryPath).ToUpperInvariant()); foreach (var e in expectations) { var cat = CreateDirectoryCatalog(e.Input, DirectoryCatalogTests.NonExistentSearchPattern); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat); Assert.AreEqual(e.Output, proxy.FullPath); } } }
[ActiveIssue("https://github.com/dotnet/runtime/issues/24240", TestPlatforms.AnyUnix)] // System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. public void LoadedFiles_EmptyDirectory_ShouldBeFine() { string directoryPath = GetTemporaryDirectory(); var cat = CreateDirectoryCatalog(directoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat); Assert.Equal(0, proxy.LoadedFiles.Count); }
public void Constuctor_ValueAsCatalogArgument_ShouldSetPathProperty() { string path = GetTemporaryDirectory(); var catalog = CreateDirectoryCatalog(path); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); Assert.Equal(path, proxy.Path); }
public void LoadedFiles_EmptyDirectory_ShouldBeFine() { using (var directory = new TemporaryDirectory()) { var cat = CreateDirectoryCatalog(directory.DirectoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat); Assert.AreEqual(0, proxy.LoadedFiles.Count); } }
public void Constructor_ValueAsCatalogArgument_ShouldSetAssemblyProperty() { var expectations = Expectations.GetAssemblies(); using (TemporaryFileCopier copier = new TemporaryFileCopier(expectations.Select(assembly => assembly.Location).ToArray())) { var catalog = CreateDirectoryCatalog(copier.DirectoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); EnumerableAssert.AreEqual(expectations, proxy.Assemblies); } }
public void Constructor_ValueAsCatalogArgument_ShouldSetAssemblyProperty() { string directoryPath = GetTemporaryDirectory(); var expectations = Expectations.GetAssemblies(); foreach (string fileName in expectations.Select(assembly => assembly.Location).ToArray()) { File.Copy(fileName, Path.Combine(directoryPath, Path.GetFileName(fileName))); } var catalog = CreateDirectoryCatalog(directoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); Assert.Equal(expectations, proxy.Assemblies); }
public void Constructor_ValueAsCatalogArgument_ShouldSetPartsProperty() { var expectations = Expectations.GetAssemblies(); foreach (var e in expectations) { string directoryPath = GetTemporaryDirectory(e.Location); var catalog = CreateDirectoryCatalog(directoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); EqualityExtensions.CheckEquals(catalog.Parts, proxy.Parts); } }
public void Constructor_ValueAsCatalogArgument_ShouldSetPartsProperty() { var expectations = Expectations.GetAssemblies(); foreach (var e in expectations) { using (TemporaryFileCopier copier = new TemporaryFileCopier(e.Location)) { var catalog = CreateDirectoryCatalog(copier.DirectoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); EnumerableAssert.AreSequenceEqual(catalog.Parts, proxy.Parts); } } }
[ActiveIssue("https://github.com/dotnet/runtime/issues/24240", TestPlatforms.AnyUnix)] // System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. public void Constuctor_ValueAsCatalogArgument_ShouldSetSearchPatternProperty() { string directoryPath = GetTemporaryDirectory(); var expectations = new ExpectationCollection <string, string>(); expectations.Add("*.*", "*.*"); expectations.Add("*.doc", "*.doc"); expectations.Add("*.exe", "*.exe"); expectations.Add("*.dll", "*.dll"); foreach (var e in expectations) { var catalog = CreateDirectoryCatalog(directoryPath, e.Input); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog); Assert.Equal(e.Output, proxy.SearchPattern); } }
public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { using (var directory = new TemporaryDirectory()) { // Add one text file using (File.CreateText(Path.Combine(directory.DirectoryPath, "Test.txt"))) { } // Add two dll's string dll1 = Path.Combine(directory.DirectoryPath, "Test1.dll"); string dll2 = Path.Combine(directory.DirectoryPath, "Test2.dll"); File.Copy(Assembly.GetExecutingAssembly().Location, dll1); File.Copy(Assembly.GetExecutingAssembly().Location, dll2); var cat = CreateDirectoryCatalog(directory.DirectoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat); CollectionAssert.AreEquivalent(new string[] { dll1.ToUpperInvariant(), dll2.ToUpperInvariant() }, proxy.LoadedFiles); } }
public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { string directoryPath = TemporaryFileCopier.GetNewTemporaryDirectory(); // Add one text file using (File.CreateText(Path.Combine(directoryPath, "Test.txt"))) { } // Add two dll's string dll1 = Path.Combine(directoryPath, "Test1.dll"); string dll2 = Path.Combine(directoryPath, "Test2.dll"); File.Copy(Assembly.GetExecutingAssembly().Location, dll1); File.Copy(Assembly.GetExecutingAssembly().Location, dll2); var cat = CreateDirectoryCatalog(directoryPath); var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat); EqualityExtensions.CheckEquals(new string[] { dll1.ToUpperInvariant(), dll2.ToUpperInvariant() }, proxy.LoadedFiles); }