Esempio n. 1
0
            public static object GetTargets(IParameters parameters)
            {
                var machineName = parameters.Required <string>("machineName");
                var remoteOne   = new PrintTask(Output)
                {
                    Description = machineName
                };
                var two = new PrintTask(Output)
                {
                    Description = parameters.Required <string>("two")
                };

                var remoteBounce = new RemoteBounce();

                RemoteBounceArguments remoteOneArgs = remoteBounce.ArgumentsForTargets(new { RemoteOne = remoteOne });

                Task <IEnumerable <string> > machines = new [] { "machine1", "machine2" };
                var one = machines.SelectTasks(machine => new RemoteExec {
                    BounceArguments = remoteOneArgs.WithParameter(machineName.WithValue(machine)),
                    Machine         = machine,
                });

                return(remoteBounce.WithRemoteTargets(new {
                    One = one,
                    Two = two,
                }));
            }
Esempio n. 2
0
            public static object GetTargets(IParameters parameters)
            {
                var remoteOne = new PrintTask(Output)
                {
                    Description = parameters.Required <string>("hack")
                };
                var two = new PrintTask(Output)
                {
                    Description = parameters.Required <string>("two")
                };

                var remoteBounce = new RemoteBounce();

                RemoteBounceArguments remoteOneArgs = remoteBounce.ArgumentsForTargets(new { RemoteOne = remoteOne });

                var one = new RemoteExec
                {
                    BounceArguments = remoteOneArgs,
                    Machine         = parameters.Required <string>("machine"),
                };

                return(remoteBounce.WithRemoteTargets(new {
                    One = one,
                    Two = two,
                }));
            }
Esempio n. 3
0
        public void ShouldReturnRemoteTargetsAsWellAsLocalTargets()
        {
            var remote = new RemoteBounce();
            var remoteOne = new Mock<ITask>().Object;
            var localOne = new Mock<ITask>().Object;

            remote.ArgumentsForTargets(new { RemoteOne = remoteOne });

            var withRemoteTargets = (IDictionary<string, ITask>) remote.WithRemoteTargets(new {LocalOne = localOne});

            Assert.That(withRemoteTargets["LocalOne"], Is.SameAs(localOne));
            Assert.That(withRemoteTargets["RemoteOne"], Is.SameAs(remoteOne));
            Assert.That(withRemoteTargets.Count, Is.EqualTo(2));
        }
Esempio n. 4
0
        public void ShouldReturnRemoteTargetsAsWellAsLocalTargets()
        {
            var remote    = new RemoteBounce();
            var remoteOne = new Mock <IObsoleteTask>().Object;
            var localOne  = new Mock <IObsoleteTask>().Object;

            remote.ArgumentsForTargets(new { RemoteOne = remoteOne });

            var withRemoteTargets = (IDictionary <string, IObsoleteTask>)remote.WithRemoteTargets(new { LocalOne = localOne });

            Assert.That(withRemoteTargets["LocalOne"], Is.SameAs(localOne));
            Assert.That(withRemoteTargets["RemoteOne"], Is.SameAs(remoteOne));
            Assert.That(withRemoteTargets.Count, Is.EqualTo(2));
        }
Esempio n. 5
0
            public static object GetTargets(IParameters parameters)
            {
                var machineName = parameters.Required<string>("machineName");
                var remoteOne = new PrintTask(Output) {Description = machineName};
                var two = new PrintTask(Output) {Description = parameters.Required<string>("two")};

                var remoteBounce = new RemoteBounce();

                RemoteBounceArguments remoteOneArgs = remoteBounce.ArgumentsForTargets(new { RemoteOne = remoteOne });

                Task<IEnumerable<string>> machines = new [] {"machine1", "machine2"};
                var one = machines.SelectTasks(machine => new RemoteExec {
                    BounceArguments = remoteOneArgs.WithParameter(machineName.WithValue(machine)),
                    Machine = machine,
                });

                return remoteBounce.WithRemoteTargets(new {
                    One = one,
                    Two = two,
                });
            }
Esempio n. 6
0
            public static object GetTargets(IParameters parameters)
            {
                var remoteOne = new PrintTask(Output) {Description = parameters.Required<string>("hack")};
                var two = new PrintTask(Output) {Description = parameters.Required<string>("two")};

                var remoteBounce = new RemoteBounce();

                RemoteBounceArguments remoteOneArgs = remoteBounce.ArgumentsForTargets(new { RemoteOne = remoteOne });

                var one = new RemoteExec
                          {
                              BounceArguments = remoteOneArgs,
                              Machine = parameters.Required<string>("machine"),
                          };

                return remoteBounce.WithRemoteTargets(new {
                    One = one,
                    Two = two,
                });
            }