public void SetUp()
        {
            _fileSystem = A.Fake <IFileSystem>();
            _file       = A.Fake <IFile>();
            _underTest  = new FileExistenceChecker(_fileSystem);

            Settings.Default.TemporaryTxtDbPath = "temp path";
            A.CallTo(() => _fileSystem.PathCombine("temp path", "Accounts.txt")).Returns("combined path");
            A.CallTo(() => _fileSystem.GetFile("combined path")).Returns(_file);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks whether the provided URL is an actual file.
        /// </summary>
        /// <param name="url">The URL of the resource to check.</param>
        /// <returns>A boolean value indicating whether the URL refers to an actual file.</returns>
        public bool IsRealFile(string url)
        {
            bool isReal = false;

            using (LogGroup logGroup = LogGroup.StartDebug("Checking whether the specified URL points to a real file."))
            {
                LogWriter.Debug("Provided URL: " + url);

                string shortUrl = GetShortPath(url);

                LogWriter.Debug("Short URL: " + shortUrl);

                //string physicalFile = FileMapper.MapPath(shortUrl);

                //LogWriter.Debug("Physical file: " + physicalFile);

                isReal = FileExistenceChecker.Exists(shortUrl);

                LogWriter.Debug("Is real? " + isReal.ToString());
            }
            return(isReal);
        }