public void ValidateLevel_DoesNothingIfLevelIsBetween1And6Inclusive(int dummyLevel) { // Arrange FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory(); // Act and assert testSubject.ValidateLevel(dummyLevel); // Pass as long as this doesn't throw }
public void ResolveBlockName_ResolvesBlockName(string dummyBlockName, string expectedResult) { // Arrange FlexiSectionBlockFactory testSubject = CreateFlexiSectionBlockFactory(); // Act string result = testSubject.ResolveBlockName(dummyBlockName); // Assert Assert.Equal(expectedResult, result); }
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); }
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)); }
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); }
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); }
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); }