예제 #1
0
        public void Beep_Template(EngineState s, string rawCode, BeepType beepType)
        {
            CodeParser  parser = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand cmd    = parser.ParseStatement(rawCode);

            CodeInfo_Beep info = cmd.Info.Cast <CodeInfo_Beep>();

            Assert.IsTrue(info.Type == beepType);
        }
예제 #2
0
        public static void StrFormat_Date_5()
        {
            const string rawCode = "StrFormat,DATE,#9,yyyymmddhhnnsszzz am/pm";
            CodeParser   parser  = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand  cmd     = parser.ParseStatement(rawCode);

            CodeInfo_StrFormat info    = cmd.Info.Cast <CodeInfo_StrFormat>();
            StrFormatInfo_Date subInfo = info.SubInfo.Cast <StrFormatInfo_Date>();

            Assert.IsTrue(subInfo.FormatString.Equals("yyyyMMddhhmmssfff tt", StringComparison.Ordinal));
        }
예제 #3
0
        public static void StrFormat_Date_1()
        {
            const string rawCode = "StrFormat,Date,%Dest%,yyyy-mm-dd_hh:nn:ss.zzz";
            CodeParser   parser  = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand  cmd     = parser.ParseStatement(rawCode);

            CodeInfo_StrFormat info    = cmd.Info.Cast <CodeInfo_StrFormat>();
            StrFormatInfo_Date subInfo = info.SubInfo.Cast <StrFormatInfo_Date>();

            Assert.IsTrue(subInfo.FormatString.Equals("yyyy-MM-dd_HH:mm:ss.fff", StringComparison.Ordinal));
        }
예제 #4
0
        public static void StrFormat_Date_4()
        {
            const string rawCode = "StrFormat,Date,%Dest%,qqqmdd_hhnnss.zzz";
            CodeParser   parser  = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand  cmd     = parser.ParseStatement(rawCode);

            // Successfully induced error
            if (cmd.Type == CodeType.Error)
            {
                return;
            }

            Assert.Fail();
        }
예제 #5
0
        public void Beep()
        {
            void Template(string rawCode, BeepType beepType)
            {
                CodeParser  parser = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
                CodeCommand cmd    = parser.ParseStatement(rawCode);

                CodeInfo_Beep info = cmd.Info.Cast <CodeInfo_Beep>();

                Assert.AreEqual(beepType, info.Type);
            }

            Template("Beep,OK", BeepType.OK);
            Template("Beep,Error", BeepType.Error);
            Template("Beep,Asterisk", BeepType.Asterisk);
            Template("Beep,Confirmation", BeepType.Confirmation);
        }