Exemplo n.º 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 Save()
 {
     if (strategy != null)
     {
         strategy.Save();
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            AbstractHandler abstractHandler = AbstractHandler.StartHandler("XML");

            abstractHandler.Create();
            abstractHandler.Open();
            abstractHandler.Change();
            abstractHandler.Save();
            Console.ReadKey();
        }
Exemplo n.º 4
0
 public void SaveTest()
 {
     _target.Save(_mockFileInfo.Name, _mockFileInfo.FullName);
     _mockFile.Received().Move(_mockFileInfo.Name, _mockFileInfo.FullName);
     _mockConsole.Received().WriteLine($"{_mockFileInfo.Name} was moved to {_mockFileInfo.FullName}.");
 }