public void TestStatusCallIsValid()
        {
            var argumentList            = DefaultArgumentList();
            StatusCallCommands commands = new StatusCallCommands(new Arguments(argumentList));

            Assert.AreEqual(true, commands.IsValid());
        }
        public void TestStatusCallIsNotValid()
        {
            String[] argumentList = DefaultArgumentList();
            argumentList[0] = "-S=";
            StatusCallCommands commands = new StatusCallCommands(new Arguments(argumentList));

            Assert.AreEqual(false, commands.IsValid());
        }
        public void TestStatusCallConstructor()
        {
            var argumentList            = DefaultArgumentList();
            StatusCallCommands commands = new StatusCallCommands(new Arguments(argumentList));

            Assert.AreEqual("999999", commands.Spon);
            Assert.AreEqual(99, commands.Status);
            Assert.AreEqual(false, commands.IsTest);
            Assert.AreEqual("www.approvalURL.com", commands.ApprovalURL);
            Assert.AreEqual(String.Empty, commands.FreelancerId);
            Assert.AreEqual(String.Empty, commands.TaskId);
            Assert.AreEqual(String.Empty, commands.OrderId);
            Assert.AreEqual(String.Empty, commands.Role);
            Assert.AreEqual(true, commands.ProcessOnInsert);
        }
        static void Main(string[] args)
        {
            try
            {
                var commands = new StatusCallCommands(new Arguments(args));

                if (!commands.IsValid())
                {
                    Log.Instance.Error("Error parsing incoming args.");
                    Log.Instance.Debug("Args:" + args);
                    return;
                }

                //var dynamicObject = commands.ToDynamic();

                //Get Connected Force Client - as this is called statically it will connect each time.
                var clientTask = GetConnection();
                //wait until connection task has completed
                clientTask.Wait();
                //insert StatusCall object into SF. Aft Insert Trigger in SF will handle running the update.
                var insertTask = InsertStatusCallToSF(clientTask.Result,
                                                      commands.Spon,
                                                      commands.ApprovalURL,
                                                      commands.Status,
                                                      commands.OrderId,
                                                      commands.TaskId,
                                                      commands.FreelancerId,
                                                      commands.IsTest,
                                                      commands.Role);
                //wait for status call object to complete - using async and wait seems overkill here but when we extend this project to for further rest
                //operations and integrations this will become necessary.
                insertTask.Wait();

                //var task = RunSample();
                //task.Wait();
            }
            catch (Exception e)
            {
                Log.Instance.Error(e.Message, e);

                var innerException = e.InnerException;
                while (innerException != null)
                {
                    Log.Instance.Error(innerException.Message, innerException);
                    innerException = innerException.InnerException;
                }
            }
        }