Exemplo n.º 1
0
        public void TestInclusiveMaximumDoesNotThrowOnEquals()
        {
            string    idf    = "Timestep,60;";
            IdfLinter linter = new IdfLinter(idf);

            Assert.IsTrue(linter.Lint().Count == 0);
        }
Exemplo n.º 2
0
        public void TestFieldNotInChoiceError()
        {
            string idf = "PerformancePrecisionTradeoffs,BadChoice;";

            IdfLinter linter = new IdfLinter(idf);
            var       errors = linter.Lint();

            Assert.IsTrue(errors.Any(error => error.GetType() == typeof(FieldNotInChoiceError)));
        }
Exemplo n.º 3
0
        public void AssertError(string idf, Type expectedErrorType, bool writeErrors = false)
        {
            IdfLinter linter = new IdfLinter(idf);
            var       errors = linter.Lint();

            Assert.IsTrue(errors.Any(error => error.GetType() == expectedErrorType));
            if (writeErrors)
            {
                errors.WriteErrors();
            }
        }
Exemplo n.º 4
0
        public void TestBuildingReferenceList()
        {
            string idf = "Schedule:Constant,  Test Schedule  ,,5;";

            IdfParser.IdfContext tree = idf.ParseIdf();

            ParseTreeWalker walker = new ParseTreeWalker();

            IdfLintListener idfLintListener = new IdfLintListener();

            walker.Walk(idfLintListener, tree);

            IdfLinter linter = new IdfLinter(idf);

            var result = linter.GetReferenceLists(idfLintListener.IdfObjects);

            Assert.IsTrue(result.ReferenceList.Count() == 1);

            Assert.IsTrue(result.ReferenceList["ScheduleNames"].Count() == 1);

            Assert.IsTrue(result.ReferenceList["ScheduleNames"].Contains("Test Schedule"));
        }