Exemple #1
0
        private static void Command()
        {
            Console.WriteLine("Введите команду");

            string command = Console.ReadLine();

            if (openr.IsMatch(command))
            {
                char[] c = { ' ', '.' };
                handler.Path = command.Split(c, StringSplitOptions.RemoveEmptyEntries)[1];
                handler.Open();
            }
            if (changer.IsMatch(command))
            {
                char[] c = { ' ', '.' };
                handler.Path = command.Split(c, StringSplitOptions.RemoveEmptyEntries)[1];
                handler.Chenge();
            }
            if (saver.IsMatch(command))
            {
                handler.Save();
                return;
            }
            if (creater.IsMatch(command))
            {
                char[] c = { ' ', '.' };
                handler.Path = command.Split(c, StringSplitOptions.RemoveEmptyEntries)[1];
                handler.Create();
            }
            Command();
        }
 public void Open()
 {
     if (strategy != null)
     {
         strategy.Open();
     }
 }
Exemple #3
0
        static void Main(string[] args)
        {
            AbstractHandler abstractHandler = AbstractHandler.StartHandler("XML");

            abstractHandler.Create();
            abstractHandler.Open();
            abstractHandler.Change();
            abstractHandler.Save();
            Console.ReadKey();
        }
Exemple #4
0
        public void OpenTest()
        {
            _target.Open("fileInfoName");
            var name         = _mockFileInfo.Received().Name;
            var creationTime = _mockFileInfo.Received().CreationTime;
            var extension    = _mockFileInfo.Received().Extension;

            _mockConsole.Received().WriteLine($"Name: fileInfoName");
            _mockConsole.Received().WriteLine($"Time: 31.12.2020 0:00:00");
            _mockConsole.Received().WriteLine($"Extension: .txt");
        }