예제 #1
0
        public void RendererProduceMarkdownV2Output()
        {
            var merger          = new MamlModelMerger(WriteMessage);
            var originalCommand = GetOriginal();
            var metadataCommand = GetRegenerated();

            var result = merger.Merge(metadataCommand, originalCommand);

            Assert.Equal(3, result.Parameters.Count);
            Assert.Equal(3, originalCommand.Parameters.Count);
            Assert.Equal("Name", result.Parameters[0].Name);
            Assert.Equal("NewParam", result.Parameters[1].Name);
            Assert.Contains("Parameter Updated: Name", _reportStream);
            Assert.Contains("Parameter Set Added: AnotherName", _reportStream);
            Assert.Contains("Parameter Set Deleted: ByName", _reportStream);
            Assert.Contains("Old Set: SetOldName", _reportStream);
            Assert.Contains("New Set: SetNewName", _reportStream);
            Assert.Contains("Parameter Added: NewParam", _reportStream);
            Assert.Contains("Parameter Deleted: Remove", _reportStream);
            Assert.Contains("---- UPDATING Cmdlet : Get-Foo ----", _reportStream);
            Assert.Contains("---- COMPLETED UPDATING Cmdlet : Get-Foo ----\r\n\r\n", _reportStream);

            Assert.Equal(originalCommand.Synopsis.Text, result.Synopsis.Text);
            Assert.Equal(originalCommand.Description.Text, result.Description.Text);
            Assert.Equal(originalCommand.Notes.Text, result.Notes.Text);
            Assert.Equal(originalCommand.Parameters[0].Description, result.Parameters[0].Description);
            Assert.Equal(originalCommand.Parameters[0].FormatOption, result.Parameters[0].FormatOption);
            Assert.Equal(originalCommand.Parameters[2].Description, result.Parameters[2].Description);
            Assert.Equal(originalCommand.Parameters[2].FormatOption, result.Parameters[2].FormatOption);

            Assert.Equal(originalCommand.Links.Count, result.Links.Count);
            Assert.Equal(originalCommand.Links[0].LinkName, result.Links[0].LinkName);
            Assert.Equal(originalCommand.Links[0].LinkUri, result.Links[0].LinkUri);
        }
예제 #2
0
        public void RendererProduceMarkdownV2Output()
        {
            var merger          = new MamlModelMerger(WriteMessage);
            var originalCommand = GetOriginal();
            var metadataCommand = GetRegenerated();

            var result = merger.Merge(metadataCommand, originalCommand);

            Assert.Equal(2, result.Parameters.Count);
            Assert.Equal(2, originalCommand.Parameters.Count);
            Assert.Equal("Name", result.Parameters[0].Name);
            Assert.Equal("NewParam", result.Parameters[1].Name);
            Assert.Contains("Get-Foo: parameter Remove is not longer present.", _reportStream);
            Assert.Contains("Get-Foo: parameter Name - description has been updated:\r\n<\r\n    Parameter Description.\r\n>\r\nreplaced\r\n[\r\n    Old Description\r\n]", _reportStream);

            Assert.Equal(originalCommand.Parameters[0].Description, result.Parameters[0].Description);

            Assert.Equal(originalCommand.Links.Count, result.Links.Count);
            Assert.Equal(originalCommand.Links[0].LinkName, result.Links[0].LinkName);
            Assert.Equal(originalCommand.Links[0].LinkUri, result.Links[0].LinkUri);
        }