public void CopyFilesExecutor_Execute_CallsShellManager_WithGivenParameters()
        {
            //// Arrange
            var activity         = GetCopyFilesActivity();
            var shellManagerMock = new Mock <IShellManager>(MockBehavior.Strict);
            var outputDestPath   = "E:\\SomeHost\\WebFolder\\Backups1122";
            var outputHashtable  = new Hashtable()
            {
                { "Count", 1 }, { "DestinationPath", outputDestPath }
            };

            shellManagerMock.Setup(sm => sm.ExecuteCommands(
                                       It.Is <String>(s => IsSameHost(s, activity.Host.HostName)),
                                       It.Is <List <ScriptWithParameters> >(paramList => ContainsParamsFromActivity(paramList.First(), (CopyFilesActivity)activity)),
                                       true)).Returns(new Collection <object>()
            {
                outputHashtable
            });
            var executor = new CopyFilesExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
            Assert.IsTrue((activity as CopyFilesActivity).DestinationPath.Equals(outputDestPath, StringComparison.CurrentCultureIgnoreCase));
        }
        public void CopyFilesExecutor_Execute_Sets_IsSuccessToFalse_DuringException()
        {
            //// Arrange
            var activity         = GetCopyFilesActivity();
            var shellManagerMock = new Mock <IShellManager>(MockBehavior.Strict);

            shellManagerMock.Setup(sm => sm.ExecuteCommands(
                                       It.Is <String>(s => IsSameHost(s, activity.Host.HostName)),
                                       It.Is <List <ScriptWithParameters> >(paramList => ContainsParamsFromActivity(paramList.First(), (CopyFilesActivity)activity)),
                                       true)).Throws(new ApplicationException("Sample exception"));
            var executor = new CopyFilesExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
            Assert.IsFalse(executor.Result.IsSuccess);
        }