コード例 #1
0
        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}");
            }
        }
コード例 #2
0
 public MapFileExists()
 {
     fileSystem = FileSystemGatewayFactory.Create(); // there is a dependency on the FileSystemGatewayFactory
 }
コード例 #3
0
 public static void SetInstance(IFileSystemGateway instance)
 {
     m_FileSystemGateway = instance;
 }
コード例 #4
0
 public MapFileExists() //existent code will still use this constructor
 {
     fileSystem = new FileSystemGateway();
 }
コード例 #5
0
 public MapFileExists(IFileSystemGateway fileSystem)
 {
     this.fileSystem = fileSystem;
 }