public void Should_Find_Number_Of_Paths() { var dict = new Dictionary <string, string[]> { { "start", new string[] { "A", "b" } }, { "A", new string[] { "start", "c", "b", "end" } }, { "b", new string[] { "start", "A", "d", "end" } }, { "c", new string[] { "A" } }, { "d", new string[] { "b" } }, { "end", new string[] { "A", "b" } }, }; var result = Spelunker.FindPaths(dict); Assert.Equal(10, result.Count); }
private static void AddToDb(string diskTitle, string rootPath) { IDiskDrive diskDrive = new FileSystemDrive(rootPath); Spelunker ddSpelunker = new Spelunker(diskDrive); ddSpelunker.SpelunkDd(); using (var db = new SpelunkerContext()) { if (!db.DiskDrives.Any(dd => dd.Title == diskTitle)) { db.Add(new DiskDrive { Title = diskTitle }); db.SaveChanges(); var disk = db.DiskDrives.First(dd => dd.Title == diskTitle); foreach (var nugget in ddSpelunker.Nuggets) { disk.Files.Add( new NuggetFile() { Title = nugget.Name, Path = nugget.Path }); } db.SaveChanges(); } else { Console.WriteLine("Disk already exists in DB"); } } }