示例#1
0
        public void ValidateLevel_DoesNothingIfLevelIsBetween1And6Inclusive(int dummyLevel)
        {
            // Arrange
            FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory();

            // Act and assert
            testSubject.ValidateLevel(dummyLevel); // Pass as long as this doesn't throw
        }
示例#2
0
        public void ResolveBlockName_ResolvesBlockName(string dummyBlockName, string expectedResult)
        {
            // Arrange
            FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory();

            // Act
            string result = testSubject.ResolveBlockName(dummyBlockName);

            // Assert
            Assert.Equal(expectedResult, result);
        }
示例#3
0
        public void ValidateLevel_ThrowsArgumentExceptionIfLevelIsLessThan1OrGreaterThan6(int dummyLevel)
        {
            // Arrange
            FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory();

            // Act
            ArgumentOutOfRangeException result = Assert.Throws <ArgumentOutOfRangeException>(() => testSubject.ValidateLevel(dummyLevel));

            // Assert
            Assert.Equal($@"{string.Format(Strings.ArgumentOutOfRangeException_Shared_ValueMustBeWithinRange, "[1, 6]", dummyLevel)}
Parameter name: level",
                         result.Message, ignoreLineEndingDifferences: true);
        }
示例#4
0
        public void GetOrCreateOpenFlexiSectionBlocks_CreatesOpenFlexiSectionBlocksIfItDoesNotAlreadyExist()
        {
            // Arrange
            var dummyMarkdownDocument            = new MarkdownDocument();
            FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory();

            // Act
            Stack <Stack <FlexiSectionBlock> > result = testSubject.GetOrCreateOpenFlexiSectionBlocks(dummyMarkdownDocument);

            // Assert
            Assert.NotNull(result);
            Assert.Same(result, dummyMarkdownDocument.GetData(FlexiSectionBlockFactory.OPEN_PROXY_SECTION_BLOCKS_KEY));
        }
示例#5
0
        public void GetOrCreateOpenFlexiSectionBlocks_GetsReferenceLinkableFlexiSectionBlocksIfItAlreadyExists()
        {
            // Arrange
            var dummyOpenFlexiSectionBlocks = new Stack <Stack <FlexiSectionBlock> >();
            var dummyMarkdownDocument       = new MarkdownDocument();

            dummyMarkdownDocument.SetData(FlexiSectionBlockFactory.OPEN_PROXY_SECTION_BLOCKS_KEY, dummyOpenFlexiSectionBlocks);
            FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory();

            // Act
            Stack <Stack <FlexiSectionBlock> > result = testSubject.GetOrCreateOpenFlexiSectionBlocks(dummyMarkdownDocument);

            // Assert
            Assert.Same(dummyOpenFlexiSectionBlocks, result);
        }
示例#6
0
        public void ValidateRenderingMode_ThrowsOptionsExceptionIfRenderingModeIsInvalid()
        {
            // Arrange
            FlexiSectionBlockFactory             testSubject        = CreateFlexiSectionBlockFactory();
            const FlexiSectionBlockRenderingMode dummyRenderingMode = (FlexiSectionBlockRenderingMode)9;

            // Act and assert
            OptionsException result = Assert.Throws <OptionsException>(() => testSubject.ValidateRenderingMode(dummyRenderingMode));

            Assert.Equal(string.Format(Strings.OptionsException_OptionsException_InvalidOption,
                                       nameof(IFlexiSectionBlockOptions.RenderingMode),
                                       string.Format(Strings.OptionsException_Shared_ValueMustBeAValidEnumValue, dummyRenderingMode,
                                                     nameof(FlexiSectionBlockRenderingMode))),
                         result.Message);
        }
示例#7
0
        public void ValidateElement_ThrowsOptionsExceptionIfElementIsInvalid()
        {
            // Arrange
            FlexiSectionBlockFactory       testSubject  = CreateFlexiSectionBlockFactory();
            const SectioningContentElement dummyElement = (SectioningContentElement)9;

            // Act and assert
            OptionsException result = Assert.Throws <OptionsException>(() => testSubject.ValidateElement(dummyElement));

            Assert.Equal(string.Format(Strings.OptionsException_OptionsException_InvalidOption,
                                       nameof(IFlexiSectionBlockOptions.Element),
                                       string.Format(Strings.OptionsException_Shared_ValueMustBeAValidEnumValue, dummyElement,
                                                     nameof(SectioningContentElement))),
                         result.Message);
        }