public void CreateTableNonExistingBucketTest()
 {
     string[] args = new string[] { "create-table", "hopefullynonexistingbucket",testTableName, testFilename, "-t", testToken };
     var command = CmdParser.ParseArguments(args);
     Controller ctrl = new Controller(command);
     var result = ctrl.Execute();
     Assert.That(result, Is.False);
 }
 public void BadTokenTest()
 {
     string[] args = new string[] { "create-table", "main", "testtable", testFilename, "-t", "adasd" };
     var command = CmdParser.ParseArguments(args);
     Controller ctrl = new Controller(command);
     var result = ctrl.Execute();
     Assert.That(result, Is.False);
 }
 public void CreateOnExistingTableTestShouldFail()
 {
     string[] args = new string[] { "create-table", testBucketId, "existingTableTest",testFilename, "-t", testToken};
     var command = CmdParser.ParseArguments(args);
     Controller ctrl = new Controller(command);
     var firstResult = ctrl.Execute();
     var secondResult = ctrl.Execute();
     Assert.That(secondResult, Is.False);
 }
        public void UpdateNonExistingTableTest(string nonExistingTableId)
        {
            string updateFileName = "filetoupdate" + DateTime.Now.Ticks + ".csv";
            string[] args = new string[] { "write-table",  nonExistingTableId,  updateFileName, "-t", testToken };

            //creates test file
            FileInfo updateFileInfo = new FileInfo(updateFileName);
            string[] dataToUpdate = PrepareDataToUpdate(100);
            System.IO.File.WriteAllLines(updateFileInfo.FullName, dataToUpdate);

            var command = CmdParser.ParseArguments(args);

            Controller ctrl = new Controller(command);
            bool result = ctrl.Execute();

            Assert.That(result, Is.False);

            updateFileInfo.Delete();
        }
Ejemplo n.º 5
0
        static int Main(string[] args)
        {
            bool success = false;
            try
            {
                // args = ParseArguments();
                // client = PrepareClient(args);
                // UploadData(args, client);

                var command = CmdParser.ParseArguments(args);
                Controller ctrl = new Controller(command);
                success = ctrl.Execute();

            }
            catch (Exception ee)
            {
                Console.WriteLine(ee.Message);
            }

            if (success)
                return 0;

            return 1;
        }
 public void WriteTableParseArgsTestShouldFail(string[] args)
 {
     var command = CmdParser.ParseArguments(args);
     Controller ctrl = new Controller(command);
     bool result = ctrl.CheckCommandLineArguments();
     Assert.That(result, Is.False);
 }
        public void ParseVerboseArgTest(string []args)
        {
            //string[] args = new string[] { "-q", "-v" };
            ///string[] args = new string[] { "create-table", "-f", "asdasd", "-t", "adasd", "-nSomeName", "-b", "sdf", "-v" };
            //string [] args = new string[]{ };
            var command = CmdParser.ParseArguments(args);
            Controller ctrl = new Controller(command);

            Assert.That(ctrl._currentLogLevel, Is.EqualTo(LogLevel.debug));
            //Assert.That(CmdParser.GlobalOpations.Verbose, Is.True);
        }
        public void ParseCreateTableArgumentsTest(string[] args)
        {
            var command = CmdParser.ParseArguments(args);
            Controller ctrl = new Controller(command);
            bool result = ctrl.CheckCommandLineArguments();

            Assert.That(result, Is.True);
            Assert.That(command, Is.InstanceOf(typeof(CreateTableCommand)));
        }
        public void CreateTableOKTest()
        {
            string[] args = new string[] { "create-table", testBucketId,testTableName, testFilename, "-t", testToken};
            var command = CmdParser.ParseArguments(args);
            Controller ctrl = new Controller(command);

            var result = ctrl.Execute();
            Assert.That(result, Is.True);
        }