public void ShouldCancelDeploymentOnTimeoutIfRequested()
        {
            Repository.Tasks
            .When(x => x.WaitForCompletion(Arg.Any <TaskResource[]>(), Arg.Any <int>(), Arg.Any <int>(), Arg.Any <Action <TaskResource[]> >()))
            .Do(x => { throw new TimeoutException(); });

            CommandLineArgs.Add("--project=" + ProjectName);
            CommandLineArgs.Add("--deploymenttimeout=00:00:01");
            CommandLineArgs.Add("--deployto=TestEnvironment");
            CommandLineArgs.Add("--version=latest");
            CommandLineArgs.Add("--progress");
            CommandLineArgs.Add("--cancelontimeout");

            Assert.Throws <CommandException>(() => deployReleaseCommand.Execute(CommandLineArgs.ToArray()));

            Repository.Tasks.Received().Cancel(taskResource);
        }
        public void ShouldCancelDeploymentOnTimeoutIfRequested()
        {
            Repository.Tasks
            .When(x => x.WaitForCompletion(Arg.Any <TaskResource[]>(), Arg.Any <int>(), TimeSpan.FromSeconds(1), Arg.Any <Func <TaskResource[], Task> >()))
            .Do(x => { throw new TimeoutException(); });

            CommandLineArgs.Add("--project=" + ProjectName);
            CommandLineArgs.Add("--deploymenttimeout=00:00:01");
            CommandLineArgs.Add("--deployto=TestEnvironment");
            CommandLineArgs.Add("--version=latest");
            CommandLineArgs.Add("--progress");
            CommandLineArgs.Add("--cancelontimeout");

            Func <Task> exec = () => deployReleaseCommand.Execute(CommandLineArgs.ToArray());

            exec.ShouldThrow <CommandException>();

            Repository.Tasks.Received().Cancel(taskResource).GetAwaiter().GetResult();
        }