public void ShowMapExistence_MapExists_ExistsMessageReturned() { FileSystemGatewayFactory.SetInstance(new FileSystemStub { Exist = true }); MapFileExists target = new MapFileExists(); string actual = target.ShowMapExistence("SomeMapCode"); Assert.AreEqual("Kml file for Map SomeMapCode exists", actual); }
public string ShowMapExistence(string mapCode) { string mapFile = mapCode + ".kml"; IFileSystemGateway fileSystem = FileSystemGatewayFactory.Create(); // a new instance is created at each method call if (fileSystem.FileExists(mapFile)) { return($"Kml file for Map {mapCode} exists"); } else { return($"NOT found for Map {mapCode}"); } }
public MapFileExists() { fileSystem = FileSystemGatewayFactory.Create(); // there is a dependency on the FileSystemGatewayFactory }