コード例 #1
0
        protected void MustGetFilesCore()
        {
            string        methodName     = GetCurrentMethod();
            List <string> dummyFileNames = new List <string>()
            {
                methodName + "_dummy1.txt",
                methodName + "_dummy2.txt",
                methodName + "_dummy3.txt"
            };

            dummyFileNames.ForEach(x => Utils.CreateDummyFile(MockData.SftpDataFolder, x, cleanFolder: false));
            string localFolder = Path.Combine(MockData.RebexDataFolder, methodName);

            SftpClient.GetFiles(localFolder);
            bool           allFilesArePresentInLocalFolder = true;
            IList <string> filePaths = Directory.GetFiles(localFolder);

            foreach (string dummyFileName in dummyFileNames)
            {
                bool dummyFileNameIsPresent = false;
                foreach (string filePath in filePaths)
                {
                    if (filePath.Contains(dummyFileName))
                    {
                        dummyFileNameIsPresent = true;
                        break;
                    }
                }
                if (!dummyFileNameIsPresent)
                {
                    allFilesArePresentInLocalFolder = false;
                    break;
                }
            }
            Assert.True(allFilesArePresentInLocalFolder);
        }