Beispiel #1
0
        public void ShoudGenerateHelpForClasses()
        {
            ScriptBlock.Create("class Person {[int]$age ; Person($a) {$this.age = $a}}; class Child : Person {[string]$School; Child([int]$a, [string]$s ) : base($a) { $this.School = $s}}").Ast.Visit(explainer);
            AnalysisResult res = explainer.GetAnalysisResult();

            Assert.AreEqual(
                "Defines a 'class', with the name 'Person'. A class is a blueprint for a type. Create a new instance of this type with [Person]::new().",
                res.Explanations[0].Description);
        }
        public void ShoudGenerateHelpForUnknownCommand()
        {
            ScriptBlock.Create("myUnknownCommand")
            .Ast
            .Visit(explainer);

            AnalysisResult res = explainer.GetAnalysisResult();

            Assert.AreEqual(
                "Unrecognized command.",
                res.Explanations[0].Description);
        }