Ejemplo n.º 1
0
        public void ExecuteCommand()
        {
            var config = CommandConfiguration.FromFile("/../../Data/CommandConfiguration.json");
            var info   = Utilities.Process.ExecuteCommand(config);

            Assert.AreEqual(config.CommandLine, info[Constants.Configuration.CommandLine]);
            Assert.AreEqual(config.CommandArguments, info[Constants.Configuration.CommandArguments]);
            Assert.IsTrue(info[Constants.Configuration.CommandOutput].ToString().Length > 0);
            Assert.IsNotNull(info[Constants.Configuration.CommandExitCode]);
        }
Ejemplo n.º 2
0
        public void PostCommandData()
        {
            var configuration = CommandConfiguration.FromFile("/../../Data/CommandConfiguration.json");
            var request       = Utilities.Process.ExecuteCommand(configuration);

            request = Processor.AddCommonRequestFields(configuration, request);
            Assert.AreEqual(configuration.DerivedMachineHash, request[Constants.Configuration.DerivedMachineHash].ToString());
            Assert.AreEqual(configuration.LocationKey, request[Constants.Configuration.LocationKey].ToString());
            Assert.AreEqual(configuration.SequenceId, request[Constants.Configuration.SequenceId].ToString());
            var response = RestClient.PostJson <dynamic>(configuration.Uri, request);

            Assert.IsNotNull(response);
        }
        public void PostCommandData()
        {
            var configuration = CommandConfiguration.FromFile("./Data/CommandConfiguration.json");
            var request       = Processor.ExecuteCommand(configuration);

            #region Validate Request
            validateCommonRequestFields(request);
            Assert.AreEqual(configuration.CommandLine, request[Constants.Configuration.CommandLine]);
            Assert.AreEqual(configuration.CommandArguments, request[Constants.Configuration.CommandArguments]);
            Assert.IsTrue(request[Constants.Configuration.CommandOutput].ToString().Length > 0);
            Assert.IsNotNull(request[Constants.Configuration.CommandExitCode]);
            #endregion

            var response = Utilities.RestClient.PostJson <Dictionary <string, object> >(configuration.Uri, request);

            #region Validate Response
            Assert.AreEqual(Constants.ObjectType.Command, response[Constants.Configuration.ObjectType].ToString());
            Assert.IsFalse(string.IsNullOrWhiteSpace(response[Constants.Configuration.ThreadTimeToLiveSec].ToString()));
            Assert.IsFalse(string.IsNullOrWhiteSpace(response[Constants.Configuration.CommandLine].ToString()));
            validateCommonResponseFields(response);
            #endregion
        }
        public void ObjectTypeCommand()
        {
            var configuration = CommandConfiguration.FromFile("./Data/CommandConfiguration.json");

            Processor.ClientServerLoop(configuration);
        }