Esempio n. 1
0
        public void Test1()
        {
            ShowdirCommand      commandOne   = new ShowdirCommand();
            ShowdiskCommand     commandTwo   = new ShowdiskCommand();
            DirectoryCommand    commandThree = new DirectoryCommand();
            StartAppCommand     commandFour  = new StartAppCommand();
            DeleteFileCommand   commandFive  = new DeleteFileCommand();
            UploadFileCommand   commandSix   = new UploadFileCommand();
            ChangeDirCommand    commandSeven = new ChangeDirCommand();
            DownloadFileCommand commandEight = new DownloadFileCommand();
            List <ICommand>     container    = new List <ICommand>();

            container.Add(commandOne);
            container.Add(commandTwo);
            container.Add(commandThree);
            container.Add(commandFour);
            container.Add(commandFive);
            container.Add(commandSix);
            container.Add(commandSeven);
            container.Add(commandEight);
            foreach (var value in container)
            {
                bool finders = false;
                foreach (var value2 in _macroCommand._commands)
                {
                    if (value2.GetType() == value.GetType())
                    {
                        finders = true;
                    }
                }
                Assert.True(finders);
            }
        }
Esempio n. 2
0
        public static ToolStripMenuItem OpenApp()
        {
            var path = Util.Reg.GetExePath();
            var cmd  = new DirectoryCommand()
            {
                Name    = Env.OpenAppText,
                Command = path,
            };

            return(cmd.ToMenuItem(Path.GetDirectoryName(path)));
        }
Esempio n. 3
0
        public void ExistsTest()
        {
            var tempPath = GetTempPath(@"SsisUnitTests\", true);

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.Exists,
                Argument1 = tempPath
            };

            object actual = target.Execute();

            Assert.AreEqual(true, actual);
        }
Esempio n. 4
0
        public void DeleteTest()
        {
            var tempPath = GetTempPath("DeleteMe", true);

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.Delete,
                Argument1 = tempPath
            };

            object actual = target.Execute();

            Assert.AreEqual(0, actual);
        }
Esempio n. 5
0
        public void DoesntExistTest()
        {
            var tempPath = GetTempPath("DoesntExist");

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.Exists,
                Argument1 = tempPath
            };

            object actual = target.Execute();

            Assert.AreEqual(false, actual);
        }
Esempio n. 6
0
        public void MoveTest()
        {
            var fromPath = GetTempPath(@"MoveFromTest", true);
            var toPath   = GetTempPath(@"MoveToTest");

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.Move,
                Argument1 = fromPath,
                Argument2 = toPath
            };

            object actual = target.Execute();

            Assert.AreEqual(0, actual);
        }
Esempio n. 7
0
        public static ToolStripMenuItem GetCreateDirecotyCommandFileMenuItem(string path)
        {
            var item = new ToolStripMenuItem(Env.CreateFolderSpecificFileText);

            item.Click += (sender, args) =>
            {
                var o = new DirectoryCommand[]
                {
                    new DirectoryCommand()
                    {
                        Name = "Custom Command", Command = "cmd"
                    },
                };
                Yaml.SaveYaml(path, o);
                File.SetAttributes(path, FileAttributes.Hidden);
            };
            item.Image = NativeLoader.GetShell32Icon(70);
            return(item);
        }
Esempio n. 8
0
        public void FileCountTest()
        {
            var tempPath = GetTempPath("FileCount", true);

            CreateTempFile(tempPath, "test1.aaa");
            CreateTempFile(tempPath, "test2.aaa");
            CreateTempFile(tempPath, "test3.aaa");

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.FileCount,
                Argument1 = tempPath,
                Argument2 = "*.aaa"
            };

            object actual = target.Execute();

            Assert.AreEqual(3, actual);
        }
Esempio n. 9
0
        public void MoveWithoutTargetTest()
        {
            var fromPath = GetTempPath(@"MoveFromTest");

            var target = new DirectoryCommand(_testSuite)
            {
                Operation = DirectoryOperation.Move,
                Argument1 = fromPath
            };

            try
            {
                target.Execute();
                Assert.Fail("Method did not throw the expected ArgumentException.");
            }
            catch (ArgumentException)
            {
                Assert.IsTrue(true);
            }
        }
Esempio n. 10
0
 private static void On(DirectoryCommand command)
 {
     foreach (var file in fileSystem.Directory())
         WriteSuccessLine(file);
 }
Esempio n. 11
0
 public override bool TryBuildCommand(string[] args, out object command)
 {
     command = new DirectoryCommand();
     return true;
 }
Esempio n. 12
0
        public void Setup()
        {
            DirectoryCommand directoryCommand = new DirectoryCommand();

            _directoryCommand = directoryCommand;
        }