public void MainTestCase() { StreetProblems target = new StreetProblems(); target.Dictionary = dictionary; Assert.AreEqual(4, target.Solve("BIG", "CAT")); Assert.AreEqual(3, target.Solve("BAT", "CAR")); }
static void Main() { string[] dictionary; SourceDest[] sourceDestPair; try { ParseInput(out dictionary, out sourceDestPair); foreach (var item in sourceDestPair) { if (dictionary.Where(s => s == item.Source).Count() != 1) { throw new ArgumentException("Missing " + item.Source); } if (dictionary.Where(s => s == item.Destination).Count() != 1) { throw new ArgumentException("Missing " + item.Destination); } } } catch (Exception ex) { Console.WriteLine("Invalid input"); Console.WriteLine(ex.ToString()); return; } StreetProblems target = new StreetProblems(); target.Dictionary = dictionary; foreach (var pairs in sourceDestPair) { Console.WriteLine(target.Solve(pairs.Source, pairs.Destination)); } }