コード例 #1
0
        public void Create_GlobalTable_TestInput()
        {
            GlobalTable globalTable = new GlobalTable();

            TextInputSymbol textInputSymbol = new TextInputSymbol(new ErrorReport(), "@authorName", "Author Name", "Description", "Rob Blake", true);

            List <BaseFunction> functionArguments = new List <BaseFunction> {
                new VariableFunction(new FuncInfo("stub", 1, 1), globalTable, "@authorName")
            };
            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@upperAuthorName", "Upper Author Name", "Description", true, true, new UpperCaseFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            globalTable.AddSymbol(textInputSymbol);
            globalTable.AddSymbol(expressionSymbol);

            string textOutput_A = globalTable.GetValueOfSymbol("@authorName");
            string exprOutput_A = globalTable.GetValueOfSymbol("@upperAuthorName");

            globalTable.Input("@authorName", "John Doe");

            string textOutput_B = globalTable.GetValueOfSymbol("@authorName");
            string exprOutput_B = globalTable.GetValueOfSymbol("@upperAuthorName");

            Assert.AreEqual("Rob Blake", textOutput_A);
            Assert.AreEqual("ROB BLAKE", exprOutput_A);

            Assert.AreEqual("John Doe", textOutput_B);
            Assert.AreEqual("JOHN DOE", exprOutput_B);
        }
コード例 #2
0
ファイル: IfDecisionFunction.cs プロジェクト: rob-bl8ke/Qik
        public void IfDecissionFunction_GivenSelectedOption_ReturnsCorrectValue()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW

            GlobalTable globalTable = new GlobalTable();

            OptionInputSymbol optionInputSymbol = new OptionInputSymbol(new ErrorReport(), "@databaseOptions", "Database Options", "Description", "ADVWORKS");

            optionInputSymbol.AddOption("ADVWORKS", "Adventure Works Database");
            optionInputSymbol.AddOption("PUBBOOKS", "Published Books Database");

            IfDecissionFunction decissionFunc = new IfDecissionFunction(new FuncInfo("stub", 1, 1), globalTable, "@databaseOptions");

            decissionFunc.AddFunction("ADVWORKS", new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "You chose DM"));
            decissionFunc.AddFunction("PUBBOOKS", new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "You chose Published Books Database"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@selectedDatabase", "Selected Database", "Description", true, true, decissionFunc);

            globalTable.AddSymbol(optionInputSymbol);
            globalTable.AddSymbol(expressionSymbol);

            Assert.AreEqual("ADVWORKS", globalTable.GetValueOfSymbol("@databaseOptions"));
            Assert.AreEqual("You chose DM", globalTable.GetValueOfSymbol("@selectedDatabase"));

            globalTable.Input("@databaseOptions", "1");

            Assert.IsTrue(expressionSymbol.IsPlaceholder);
            Assert.IsTrue(expressionSymbol.IsVisibleToEditor);

            Assert.AreEqual("PUBBOOKS", globalTable.GetValueOfSymbol("@databaseOptions"));
            Assert.AreEqual("You chose Published Books Database", globalTable.GetValueOfSymbol("@selectedDatabase"));
        }
コード例 #3
0
ファイル: WizardSet.cs プロジェクト: tiago156/OptionsOracle
        public void UpdateIndicator(int index, string name, string equation, string format)
        {
            DataRow row = GlobalRow;

            if (name != null)
            {
                row["Indicator" + index.ToString() + "Name"] = name;
            }
            else
            {
                row["Indicator" + index.ToString() + "Name"] = DBNull.Value;
            }
            if (equation != null)
            {
                row["Indicator" + index.ToString() + "Equation"] = equation;
            }
            else
            {
                row["Indicator" + index.ToString() + "Equation"] = DBNull.Value;
            }
            if (format != null)
            {
                row["Indicator" + index.ToString() + "Format"] = format;
            }
            else
            {
                row["Indicator" + index.ToString() + "Format"] = DBNull.Value;
            }

            GlobalTable.AcceptChanges();
        }
コード例 #4
0
ファイル: BaseFunction.cs プロジェクト: rob-bl8ke/Qik
 internal BaseFunction(FuncInfo funcInfo, GlobalTable scopeTable)
 {
     this.Line              = funcInfo.Line;
     this.Column            = funcInfo.Column;
     this.Name              = funcInfo.Name;
     this.scopeTable        = scopeTable;
     this.functionArguments = new List <BaseFunction>();
 }
コード例 #5
0
ファイル: WizardSet.cs プロジェクト: tiago156/OptionsOracle
        private void UpdateGlobalConfigTable(bool update_version)
        {
            DataRow row = GlobalRow;

            row["Version"] = update_version ? Config.Local.CurrentVersion : "0.0.0.0";

            GlobalTable.AcceptChanges();
        }
コード例 #6
0
ファイル: HistorySet.cs プロジェクト: tiago156/OptionsOracle
        public void Update()
        {
            // check if data-base is already up-to-date.
            if (HistoryTable.Rows.Count > 0 && GlobalTable.Rows.Count > 0 &&
                GlobalTable.Rows[0]["LastUpdate"] != DBNull.Value &&
                ((DateTime)GlobalTable.Rows[0]["LastUpdate"]).ToShortDateString() == DateTime.Now.ToShortDateString())
            {
                return;
            }

            // get stock's option list
            ArrayList list = null;

            // clear data-set
            Clear();

            list = Comm.Server.GetHistoricalData(symbol, DateTime.Now.AddYears(-2), DateTime.Now);
            if (list == null || list.Count == 0)
            {
                return;
            }

            // begin updating data
            HistoryTable.BeginLoadData();
            GlobalTable.BeginLoadData();

            // clear data-set
            Clear();

            foreach (History history in list)
            {
                // add option to table
                AddHistoryEntry(history);
            }

            // update time-stamp
            DataRow row = GlobalTable.NewRow();

            row["Symbol"]     = symbol;
            row["LastUpdate"] = DateTime.Now;
            GlobalTable.Rows.Add(row);

            // accept changes
            GlobalTable.AcceptChanges();
            HistoryTable.AcceptChanges();

            // end updating data
            GlobalTable.EndLoadData();
            HistoryTable.EndLoadData();

            // save history data-base
            Save();
        }
コード例 #7
0
        public void RemovePunctuationFunction_InputPunctuatedText_OutputPunctuationRemoved_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW
            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "LITERAL?!..TEXT."));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@removePunctuation", "Remove Punctuation Function", "Remove Punctuation Function", true, true, new RemovePunctuationFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            Assert.AreEqual("@removePunctuation", expressionSymbol.Symbol);
            Assert.AreEqual("@{removePunctuation}", expressionSymbol.Placeholder);
            Assert.AreEqual("Remove Punctuation Function", expressionSymbol.Title);

            Assert.AreEqual("LITERALTEXT", expressionSymbol.Value);
        }
コード例 #8
0
        public void CamelCaseFunction_InputPascalCase_OutputsCamelCase_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW
            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "LiteralText"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@classInstance", "Class Instance", "Description", true, true, new CamelCaseFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            Assert.AreEqual("@classInstance", expressionSymbol.Symbol);
            Assert.AreEqual("@{classInstance}", expressionSymbol.Placeholder);
            Assert.AreEqual("Class Instance", expressionSymbol.Title);

            Assert.AreEqual("literalText", expressionSymbol.Value);
        }
コード例 #9
0
        public void ProperCaseFunction_InputUpperCase_OutputsProperCase_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW

            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "LITERAL TEXT"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@toProperCase", "Proper Case Function", "Proper Case Function", true, true, new ProperCaseFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            Assert.AreEqual("@toProperCase", expressionSymbol.Symbol);
            Assert.AreEqual("@{toProperCase}", expressionSymbol.Placeholder);
            Assert.AreEqual("Proper Case Function", expressionSymbol.Title);

            Assert.AreEqual("Literal Text", expressionSymbol.Value);
        }
コード例 #10
0
ファイル: LevelOneController.cs プロジェクト: bolitj01/Seeker
        public IActionResult Index()
        {
            //date range to search in (yyyy,m,d)
            DateTime startDate = new DateTime(1920, 1, 1);
            DateTime endDate   = new DateTime(1960, 1, 1);

            //create a connection to the database
            DataBase db = new DataBase();

            //get the data for the global table
            List <GlobalData> globalData = GlobalTable.processGlobalData(db, startDate, endDate);

            db.CloseDataBase();
            SearchModel model = new SearchModel();

            model.SearchTerms = "";
            model.globalData  = globalData;
            return(View(model));
        }
コード例 #11
0
        public void ConcatenateFunction_Input3Strings_ConcatenatesToSingleString_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW
            GlobalTable globalTable = new GlobalTable();

            ConcatenateFunction concatFunc = new ConcatenateFunction(new FuncInfo("stub", 1, 1), globalTable);

            concatFunc.AddFunction(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "hello"));
            concatFunc.AddFunction(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, " "));
            concatFunc.AddFunction(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "world"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@concat", "Concatenated String", "Description", true, true, concatFunc);

            Assert.AreEqual("@concat", expressionSymbol.Symbol);
            Assert.AreEqual("@{concat}", expressionSymbol.Placeholder);
            Assert.AreEqual("Concatenated String", expressionSymbol.Title);

            Assert.AreEqual("hello world", expressionSymbol.Value);
        }
コード例 #12
0
        public void CurrentDateFunction_RequestDate_ReturnsCurrentDate_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW
            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "dd/MM/yyyy"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@currentDate", "Current Date", "Description", true, true, new CurrentDateFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            Assert.AreEqual("@currentDate", expressionSymbol.Symbol);
            Assert.AreEqual("@{currentDate}", expressionSymbol.Placeholder);
            Assert.AreEqual("Current Date", expressionSymbol.Title);

            DateTime dateTime = DateTime.Now;

            Assert.AreEqual(DateTime.Now.ToString("dd/MM/yyyy"), expressionSymbol.Value);
        }
コード例 #13
0
ファイル: ReplaceFunctionTests.cs プロジェクト: rob-bl8ke/Qik
        public void ReplaceFunction_InputText_ReplacesCorrectly_1()
        {
            // BEFORE REMOVING THIS TEST METHOD YOU NEED TO WRITE TESTS FOR ALL ITS POSSIBILITIES IN THE NEW STYLE BELOW

            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "Dashboard Usage"));
            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, " "));
            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "_"));

            ExpressionSymbol expressionSymbol = new ExpressionSymbol(new ErrorReport(), "@classInstance", "Class Instance", "Description", true, true, new ReplaceFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments));

            Assert.AreEqual("@classInstance", expressionSymbol.Symbol);
            Assert.AreEqual("@{classInstance}", expressionSymbol.Placeholder);
            Assert.AreEqual("Class Instance", expressionSymbol.Title);

            Assert.AreEqual("Dashboard_Usage", expressionSymbol.Value);
        }
コード例 #14
0
ファイル: LevelOneController.cs プロジェクト: bolitj01/Seeker
        public IActionResult DateChange(string terms)
        {
            //parse the string into it's values  --- format (1492:2020)
            string[] splitTerms = terms.Split(":");

            Console.WriteLine("Year range: " + splitTerms[0] + " -to- " + splitTerms[1]);

            //date range to search in (yyyy,m,d)
            DateTime startDate = new DateTime(Int32.Parse(splitTerms[0]), 1, 1);
            DateTime endDate   = new DateTime(Int32.Parse(splitTerms[1]), 1, 1);

            //create a connection to the database
            DataBase db = new DataBase();

            //get the data for the global table
            List <GlobalData> globalData = GlobalTable.processGlobalData(db, startDate, endDate);

            db.CloseDataBase();

            return(new JsonResult(globalData));
        }
コード例 #15
0
        public void Placeholder_NotAvailable_When_IsPlaceholder_False()
        {
            GlobalTable globalTable = new GlobalTable();

            List <BaseFunction> functionArguments = new List <BaseFunction>();

            functionArguments.Add(new TextFunction(new FuncInfo("stub", 1, 1), globalTable, "dd/MM/yyyy"));

            CurrentDateFunction currentDateFunction = new CurrentDateFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments);
            UpperCaseFunction   upperCaseFunction   = new UpperCaseFunction(new FuncInfo("stub", 1, 1), globalTable, functionArguments);


            ExpressionSymbol expressionSymbol1 = new ExpressionSymbol(new ErrorReport(), "@currentDate", "Current Date", "Description", false, true, currentDateFunction);
            ExpressionSymbol expressionSymbol2 = new ExpressionSymbol(new ErrorReport(), "@camelCase", "Camel Cased", "Description", true, true, upperCaseFunction);

            globalTable.AddSymbol(expressionSymbol1);
            globalTable.AddSymbol(expressionSymbol2);

            Assert.AreEqual(1, globalTable.Placeholders.Length);
            Assert.AreEqual("@{camelCase}", globalTable.Placeholders[0]);
            Assert.AreEqual("DD/MM/YYYY", globalTable.GetValueOfSymbol("@camelCase"));
        }
コード例 #16
0
 internal UserInputVisitor(GlobalTable scopeTable, IErrorReport errorReport)
 {
     this.scopeTable  = scopeTable;
     this.errorReport = errorReport;
 }
コード例 #17
0
ファイル: IntegerFunction.cs プロジェクト: rob-bl8ke/Qik
 public IntegerFunction(FuncInfo funcInfo, GlobalTable scopeTable, string text)
     : base(funcInfo, scopeTable)
 {
     this.text = text;
 }
コード例 #18
0
 internal TextFunction(FuncInfo funcInfo, GlobalTable scopeTable, string text) : base(funcInfo, scopeTable)
 {
     this.text = text;
 }
コード例 #19
0
 public PadLeftFunction(FuncInfo funcInfo, GlobalTable scopeTable, List <BaseFunction> functionArguments) : base(funcInfo, scopeTable, functionArguments)
 {
 }
コード例 #20
0
 public VariableFunction(FuncInfo funcInfo, GlobalTable scopeTable, string symbol)
     : base(funcInfo, scopeTable)
 {
     this.symbol = symbol;
 }
コード例 #21
0
ファイル: CurrentDateFunction.cs プロジェクト: rob-bl8ke/Qik
 internal CurrentDateFunction(FuncInfo funcInfo, GlobalTable scopeTable, List <BaseFunction> functionArguments)
     : base(funcInfo, scopeTable, functionArguments)
 {
 }
コード例 #22
0
ファイル: IfDecissionFunction.cs プロジェクト: rob-bl8ke/Qik
 internal IfDecissionFunction(FuncInfo funcInfo, GlobalTable scopeTable, string symbol)
     : base(funcInfo, scopeTable)
 {
     this.symbol     = symbol;
     this.scopeTable = scopeTable;
 }
コード例 #23
0
ファイル: ConcatenateFunction.cs プロジェクト: rob-bl8ke/Qik
 internal ConcatenateFunction(FuncInfo funcInfo, GlobalTable scopeTable)
     : base(funcInfo, scopeTable)
 {
     this.scopeTable = scopeTable;
 }
コード例 #24
0
ファイル: Program.cs プロジェクト: FarisFreak/PointBlankGSP
        public static void Main(string[] args)
        {
            Config.load();
            Console.Title = "PointBlank Server Auth";
            CLogger.getInstance().form();
            GlobalConsole.Load();
            GlobalTable.Load();
            GlobalDate.Load();
            GlobalNetwork.Load();
            while (true)
            {
                Thread.Sleep(200);
                Console.Write("> ");
                try
                {
                    string command = Console.ReadLine();
                    switch (command)
                    {
                    case "stop":
                    case "close":
                    case "exit":
                    {
                        CLogger.getInstance().write(command);
                        CLogger.getInstance().red("END OF LOG");
                        Thread.Sleep(200);
                        Process.GetCurrentProcess().CloseMainWindow();
                        break;
                    }

                    case "reload shop":
                    {
                        CLogger.getInstance().write(command);
                        CLogger.getInstance().debug("[Reload] ShopManager");
                        ShopInfoManager.getInstance();
                        Console.ResetColor();
                        break;
                    }

                    case "clear":
                    {
                        Console.Clear();
                        break;
                    }

                    case "help":
                    {
                        CLogger.getInstance().write(command);
                        CLogger.getInstance().cyan("Help Command: ");
                        CLogger.getInstance().debug("* stop / close / exit - Close Server.");
                        CLogger.getInstance().debug("* reload shop         - Reload Shop.");
                        CLogger.getInstance().debug("* clear               - Clear Console");
                        CLogger.getInstance().debug("* restart             - Restart Server.");
                        Console.ResetColor();
                        break;
                    }

                    case "restart":
                    {
                        var location = Assembly.GetExecutingAssembly().Location;
                        Process.Start(location);
                        Environment.Exit(0);
                        break;
                    }

                    default:
                    {
                        CLogger.getInstance().write(command);
                        CLogger.getInstance().warning("Invalid command!");
                        break;
                    }
                    }
                }
                catch
                {
                }
            }
        }
コード例 #25
0
 public RemovePunctuationFunction(FuncInfo funcInfo, GlobalTable scopeTable, List <BaseFunction> functionArguments)
     : base(funcInfo, scopeTable, functionArguments)
 {
 }
コード例 #26
0
 public HtmlEncodeFunction(FuncInfo funcInfo, GlobalTable scopeTable, List <BaseFunction> functionArguments) : base(funcInfo, scopeTable, functionArguments)
 {
 }