Example #1
0
        public void Setup()
        {
            _fileProviderMock = new Mock <IFileProvider>();
            _fileProviderMock.Setup(file => file.FindFolderLocation(It.Is <string>(s => s.Contains("C:\\StartLocation")))).Returns(false);
            _fileProviderMock.Setup(file => file.FindFolderLocation(It.Is <string>(s => s.Contains("C:\\StartLocationExists")))).Returns(true);
            _fileProviderMock.Setup(file => file.FindFolderLocation(It.Is <string>(s => s.Contains("C:\\EndLocation")))).Returns(false);
            _fileProviderMock.Setup(file => file.FindFolderLocation(It.Is <string>(s => s.Contains("C:\\EndLocationExists")))).Returns(true);

            _fpc = new Fpc(_fileProviderMock.Object);
        }
        public static void Main(string[] args)  // two arguments - first is start location, second is end location
        {
            Fpc fpc = new Fpc(new FileProvider());

            try
            {
                fpc.Cut(args[0], args[1]);
            }
            catch (IndexOutOfRangeException)
            {
                Console.WriteLine($"+++ Not all arguments provided - quitting... +++");
            }
            catch (FileNotFoundException error)
            {
                Console.WriteLine($"+++ {error.Message} - quitting... +++");
            }
            catch (Exception error)     // generic catch all
            {
                Console.WriteLine($"+++ Unknown Error: {error.Message} - quitting... +++");
            }
        }