Esempio n. 1
0
        public void FlexiCodeBlockOptions_ThrowsExceptionIfAPhraseGroupsRegexIsUnspecified()
        {
            // Arrange
            string dummyJson = $@"{{""{nameof(FlexiCodeBlockOptions.HighlightedPhrases)}"": [{{ }}]}}";
            var    dummyFlexiCodeBlockOptions = new FlexiCodeBlockOptions();

            // Act and assert
            Assert.Throws <ArgumentNullException>(() => JsonConvert.PopulateObject(dummyJson, dummyFlexiCodeBlockOptions));
        }
Esempio n. 2
0
        public void FlexiCodeBlockOptions_CanBePopulated(SerializableWrapper <FlexiCodeBlockOptions> dummyInitialOptionsWrapper,
                                                         SerializableWrapper <FlexiCodeBlockOptions> dummyExpectedOptionsWrapper,
                                                         string dummyJson)
        {
            // Act
            JsonConvert.PopulateObject(dummyJson, dummyInitialOptionsWrapper.Value);

            // Assert
            FlexiCodeBlockOptions result         = dummyInitialOptionsWrapper.Value;
            FlexiCodeBlockOptions expectedResult = dummyExpectedOptionsWrapper.Value;

            Assert.Equal(expectedResult.BlockName, result.BlockName);
            Assert.Equal(expectedResult.Title, result.Title);
            Assert.Equal(expectedResult.CopyIcon, result.CopyIcon);
            Assert.Equal(expectedResult.RenderHeader, result.RenderHeader);
            Assert.Equal(expectedResult.Language, result.Language);
            Assert.Equal(expectedResult.SyntaxHighlighter, result.SyntaxHighlighter);
            Assert.Equal(expectedResult.LineNumbers, result.LineNumbers);
            Assert.Equal(expectedResult.OmittedLinesIcon, result.OmittedLinesIcon);
            Assert.Equal(expectedResult.HighlightedLines, result.HighlightedLines);
            Assert.Equal(expectedResult.HighlightedPhrases, result.HighlightedPhrases);
            Assert.Equal(expectedResult.RenderingMode, result.RenderingMode);
            Assert.Equal(expectedResult.Attributes, result.Attributes);
        }