private static List <ConnectedStations> LoadConnectedStationsFrom(string fileLocation) { var routingDataStore = new RoutingDataStore(); routingDataStore.LoadFrom(fileLocation); return(routingDataStore.ConnectedStations); }
public void Should_throw_exception_if_routing_data_can_not_be_found() { var routingDataStore = new RoutingDataStore(); var exception = Assert.Throws <FileNotFoundException>(() => routingDataStore.LoadFrom("test-data.txt")); Assert.That(exception.Message, Is.EqualTo("Routing data file could not be found")); }
public void Should_throw_exception_if_routing_data_file_is_empty() { File.WriteAllText("test-data.txt", ""); var routingDataStore = new RoutingDataStore(); var exception = Assert.Throws <FileLoadException>(() => routingDataStore.LoadFrom("test-data.txt")); Assert.That(exception.Message, Is.EqualTo("Routing data file contained no data")); }
public void Should_populate_connected_stations_from_data_file() { File.WriteAllText("test-data.txt", "AB4, BC5, DC6"); var routingDataStore = new RoutingDataStore(); routingDataStore.LoadFrom("test-data.txt"); var firstConnectedStation = routingDataStore.ConnectedStations.First(); Assert.That(firstConnectedStation.StartStation, Is.EqualTo("A")); Assert.That(firstConnectedStation.EndStation, Is.EqualTo("B")); Assert.That(firstConnectedStation.Distance, Is.EqualTo(4)); Assert.That(routingDataStore.ConnectedStations.Count(), Is.EqualTo(3)); }