コード例 #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);
            }
        }
コード例 #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)));
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: EkardNT/CS143B
 private static void On(DirectoryCommand command)
 {
     foreach (var file in fileSystem.Directory())
         WriteSuccessLine(file);
 }
コード例 #11
0
ファイル: CommandBuilders.cs プロジェクト: EkardNT/CS143B
 public override bool TryBuildCommand(string[] args, out object command)
 {
     command = new DirectoryCommand();
     return true;
 }
コード例 #12
0
        public void Setup()
        {
            DirectoryCommand directoryCommand = new DirectoryCommand();

            _directoryCommand = directoryCommand;
        }