/// <summary> /// Creates a <see cref="FlexiOptionsBlocksExtension"/>. /// </summary> /// <param name="flexiOptionsBlockParser">The <see cref="ProxyBlockParser{TMain, TProxy}"/> for creating <see cref="FlexiOptionsBlock"/>s from markdown.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiOptionsBlockParser"/> is <c>null</c>.</exception> public FlexiOptionsBlocksExtension(ProxyBlockParser <FlexiOptionsBlock, ProxyJsonBlock> flexiOptionsBlockParser) : base(null, flexiOptionsBlockParser) { if (flexiOptionsBlockParser == null) { throw new ArgumentNullException(nameof(flexiOptionsBlockParser)); } }
public void Constructor_ThrowsArgumentNullExceptionIfFlexiTableBlockRendererIsNull() { // Arrange var dummyFlexiTableBlockParsers = new ProxyBlockParser <FlexiTableBlock, ProxyTableBlock>[] { _mockRepository.Create <ProxyBlockParser <FlexiTableBlock, ProxyTableBlock> >().Object }; // Act and assert Assert.Throws <ArgumentNullException>(() => new FlexiTableBlocksExtension(dummyFlexiTableBlockParsers, null)); }
/// <summary> /// Creates a <see cref="FlexiVideoBlocksExtension"/>. /// </summary> /// <param name="flexiVideoBlockParser">The <see cref="BlockParser{T}"/> for parsing <see cref="FlexiVideoBlock"/>s from markdown.</param> /// <param name="flexiVideoBlockRenderer">The <see cref="BlockRenderer{T}"/> for rendering <see cref="FlexiVideoBlock"/>s as HTML.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiVideoBlockParser"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiVideoBlockRenderer"/> is <c>null</c>.</exception> public FlexiVideoBlocksExtension(ProxyBlockParser <FlexiVideoBlock, ProxyJsonBlock> flexiVideoBlockParser, BlockRenderer <FlexiVideoBlock> flexiVideoBlockRenderer) : base(flexiVideoBlockRenderer, flexiVideoBlockParser) { if (flexiVideoBlockParser == null) { throw new ArgumentNullException(nameof(flexiVideoBlockParser)); } if (flexiVideoBlockRenderer == null) { throw new ArgumentNullException(nameof(flexiVideoBlockRenderer)); } }
/// <summary> /// Creates a <see cref="FlexiCodeBlocksExtension"/>. /// </summary> /// <param name="indentedFlexiCodeBlockParser">The <see cref="ProxyBlockParser{TMain, TProxy}"/> for creating <see cref="FlexiCodeBlock"/>s from indented code in markdown.</param> /// <param name="fencedFlexiCodeBlockParsers">The <see cref="ProxyBlockParser{TMain, TProxy}"/>s for creating <see cref="FlexiCodeBlock"/>s from fenced code in markdown.</param> /// <param name="flexiCodeBlockRenderer">The <see cref="BlockRenderer{T}"/> for rendering <see cref="FlexiCodeBlock"/>s as HTML.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="indentedFlexiCodeBlockParser"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="fencedFlexiCodeBlockParsers"/> is <c>null</c>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="fencedFlexiCodeBlockParsers"/> does not contain at least two elements.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiCodeBlockRenderer"/> is <c>null</c>.</exception> public FlexiCodeBlocksExtension(ProxyBlockParser <FlexiCodeBlock, ProxyLeafBlock> indentedFlexiCodeBlockParser, IEnumerable <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> > fencedFlexiCodeBlockParsers, BlockRenderer <FlexiCodeBlock> flexiCodeBlockRenderer) : base(flexiCodeBlockRenderer, new BlockParser[] { indentedFlexiCodeBlockParser, fencedFlexiCodeBlockParsers.ElementAt(0), fencedFlexiCodeBlockParsers.ElementAt(1) }) // Throws if fencedFlexiCodeBlockParsers is null or has < 2 elements { if (indentedFlexiCodeBlockParser == null) { throw new ArgumentNullException(nameof(indentedFlexiCodeBlockParser)); } if (flexiCodeBlockRenderer == null) { throw new ArgumentNullException(nameof(flexiCodeBlockRenderer)); } }
public ExposedFlexiCodeBlocksExtension(ProxyBlockParser <FlexiCodeBlock, ProxyLeafBlock> indentedFlexiCodeBlockParser, IEnumerable <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> > fencedFlexiCodeBlockParsers, BlockRenderer <FlexiCodeBlock> flexiCodeBlockRenderer) : base(indentedFlexiCodeBlockParser, fencedFlexiCodeBlockParsers, flexiCodeBlockRenderer) { }
private ExposedFlexiCodeBlocksExtension CreateExposedFlexiCodeBlocksExtension(ProxyBlockParser <FlexiCodeBlock, ProxyLeafBlock> indentedFlexiCodeBlockParser = null, IEnumerable <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> > fencedFlexiCodeBlockParsers = null, BlockRenderer <FlexiCodeBlock> flexiCodeBlockRenderer = null) { return(new ExposedFlexiCodeBlocksExtension(indentedFlexiCodeBlockParser ?? _mockRepository.Create <ProxyBlockParser <FlexiCodeBlock, ProxyLeafBlock> >().Object, fencedFlexiCodeBlockParsers ?? new List <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> > { _mockRepository.Create <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> >().Object, _mockRepository.Create <ProxyBlockParser <FlexiCodeBlock, ProxyFencedLeafBlock> >().Object }, flexiCodeBlockRenderer ?? _mockRepository.Create <BlockRenderer <FlexiCodeBlock> >().Object)); }