public void TestPackageDirectoryReturnedSecondDepth() { DirectoryInfo package = new DirectoryInfo(Path.Combine(this.TestTestGetProtocolPackages.FullName, "Something.Protocols.Something")); var dll = new FileInfo(Path.Combine(package.FullName, "SubDirectory", "Something.Protocols.Something.dll")); if (dll.Directory != null) dll.Directory.Create(); File.WriteAllText(dll.FullName, @"binary"); var protocols = new ProtocolController() { PackagesDirectory = this.TestTestGetProtocolPackages }; var packages = protocols.GetProtocolPackages(new List<FileInfo>() { dll }); Assert.AreEqual(1, packages.Count); Assert.AreEqual(package.FullName, packages.First().FullName); }
public void TestLatestPackagePathReturned() { DirectoryInfo latest = new DirectoryInfo(Path.Combine(this.TestTestGetProtocolPackages.FullName, "Something.Protocols.Something.2.0.0")); DirectoryInfo oldest = new DirectoryInfo(Path.Combine(this.TestTestGetProtocolPackages.FullName, "Something.Protocols.Something.1.0.0")); var latestDll = new FileInfo(Path.Combine(latest.FullName, "SubDirectory", "Something.Protocols.Something.dll")); if (latestDll.Directory != null) latestDll.Directory.Create(); File.WriteAllText(latestDll.FullName, @"binary"); var oldestDll = new FileInfo(Path.Combine(oldest.FullName, "SubDirectory", "Something.Protocols.Something.dll")); if (oldestDll.Directory != null) oldestDll.Directory.Create(); File.WriteAllText(oldestDll.FullName, @"binary"); var protocols = new ProtocolController() { PackagesDirectory = this.TestTestGetProtocolPackages }; var packages = protocols.GetProtocolPackages(new List<FileInfo>() { latestDll, oldestDll }); Assert.AreEqual(1, packages.Count); Assert.AreEqual(latest.FullName, packages.First().FullName); }