public void CreateProxy_ThrowsArgumentNullExceptionIfBlockProcessorIsNull() { // Arrange Mock <BlockParser> dummyBlockParser = _mockRepository.Create <BlockParser>(); FlexiTableBlockFactory testSubject = CreateFlexiTableBlockFactory(); // Act and assert Assert.Throws <ArgumentNullException>(() => testSubject.CreateProxy(null, dummyBlockParser.Object)); }
public void ResolveBlockName_ResolvesBlockName(string dummyBlockName, string expectedResult) { // Arrange FlexiTableBlockFactory testSubject = CreateFlexiTableBlockFactory(); // Act string result = testSubject.ResolveBlockName(dummyBlockName); // Assert Assert.Equal(expectedResult, result); }
public void ValidateType_ThrowsOptionsExceptionIfTypeIsInvalid() { // Arrange FlexiTableBlockFactory testSubject = CreateFlexiTableBlockFactory(); const FlexiTableType dummyType = (FlexiTableType)9; // Act and assert OptionsException result = Assert.Throws <OptionsException>(() => testSubject.ValidateType(dummyType)); Assert.Equal(string.Format(Strings.OptionsException_OptionsException_InvalidOption, nameof(IFlexiTableBlockOptions.Type), string.Format(Strings.OptionsException_Shared_ValueMustBeAValidEnumValue, dummyType, nameof(FlexiTableType))), result.Message); }
public void CreateProxy_CreatesProxyTableBlock() { // Arrange const int dummyColumn = 2; const int dummyLineStart = 7; const int dummyLineEnd = 99; BlockProcessor dummyBlockProcessor = MarkdigTypesFactory.CreateBlockProcessor(); dummyBlockProcessor.Column = dummyColumn; dummyBlockProcessor.Line = new StringSlice("", dummyLineStart, dummyLineEnd); Mock <BlockParser> dummyBlockParser = _mockRepository.Create <BlockParser>(); FlexiTableBlockFactory testSubject = CreateFlexiTableBlockFactory(); // Act ProxyTableBlock result = testSubject.CreateProxy(dummyBlockProcessor, dummyBlockParser.Object); // Assert Assert.Equal(dummyColumn, result.Column); Assert.Equal(dummyLineStart, result.Span.Start); Assert.Equal(dummyLineEnd, result.Span.End); Assert.Same(dummyBlockParser.Object, result.Parser); Assert.Equal(nameof(FlexiTableBlock), result.MainTypeName); }