public void RenderProducesRequiredParameters()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Equal(1, writtenModel.RequiredParameters.Count);

            var requiredParameter = writtenModel.RequiredParameters.Single();
            var expectedParameter = model.Parameters.Single(p => p.Required);

            Assert.Equal(expectedParameter.Globbing, requiredParameter.AcceptWildcardCharacters);
            Assert.Equal(expectedParameter.Aliases, requiredParameter.Aliases);
            Assert.Equal(expectedParameter.DefaultValue, requiredParameter.DefaultValue);
            Assert.Equal(expectedParameter.Description, requiredParameter.Description);
            Assert.Equal(expectedParameter.Name, requiredParameter.Name);
            Assert.Equal(expectedParameter.ParameterValueGroup, requiredParameter.ParameterValueGroup);
            Assert.Equal(expectedParameter.PipelineInput, requiredParameter.PipelineInput);
            Assert.Equal(expectedParameter.Position, requiredParameter.Position);
            Assert.Equal(expectedParameter.Type, requiredParameter.Type);
        }
        public void RenderProducesModule()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.NotNull(writtenModel.Module);

            Assert.Equal(model.ModuleName, writtenModel.Module.Name);
        }
        public void RendererProducesNameAndTextFields()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.NotNull(writtenModel);
            Assert.Equal(model.Name, writtenModel.Name);
            Assert.Equal(model.Description, writtenModel.Remarks);
            Assert.Equal(model.Synopsis, writtenModel.Summary);
            Assert.Equal(model.Notes, writtenModel.Notes);
        }
        public void RenderProducesLinks()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Equal(1, writtenModel.Links.Count);

            var link = writtenModel.Links.Single();

            Assert.Equal(model.Links.Single().LinkName, link.Text);
            Assert.Equal(model.Links.Single().LinkUri, link.Href);
        }
        public void RenderProducesInputs()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Equal(1, writtenModel.Inputs.Count);

            var input = writtenModel.Inputs.Single();

            Assert.Equal(model.Inputs.Single().Description, input.Description);
            Assert.Equal(model.Inputs.Single().TypeName, input.Type);
        }
        public void RenderProducesOutputs()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Single(writtenModel.Outputs);

            var outputItem = writtenModel.Outputs.Single();

            Assert.Equal(model.Outputs.Single().TypeName, outputItem.Type);
            Assert.Equal(model.Outputs.Single().Description, outputItem.Description);
        }
        public void RenderProducesExamples()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Equal(1, writtenModel.Examples.Count);

            var example = writtenModel.Examples.Single();

            Assert.Equal(model.Examples.Single().Introduction, example.PreCode);
            Assert.Equal(model.Examples.Single().Code, example.Code);
            Assert.Equal(model.Examples.Single().Remarks, example.PostCode);
            Assert.Equal(model.Examples.Single().Title, example.Name);
        }
        public void RenderProducesSyntaxes()
        {
            var model = CreateModel();

            var output = YamlRenderer.MamlModelToString(model);

            var deserializer = CreateDeserializer();

            var writtenModel = deserializer.Deserialize <YamlCommand>(output);

            Assert.Equal(1, writtenModel.Syntaxes.Count);

            var syntax = writtenModel.Syntaxes.Single();

            Assert.Equal(model.Syntax.Single().ParameterSetName, syntax.ParameterValueGroup);

            Assert.Equal(1, syntax.Parameters.Count);
            Assert.Equal(model.Syntax.Single().Parameters.Single().Name, syntax.Parameters.Single());
        }
Beispiel #9
0
 public DocumentRenderer(string documentName, IServiceContainer services)
 {
     _codeBlockRenderer = new RCodeBlockRenderer(documentName, services);
     _yamlRenderer      = new YamlRenderer();
 }