public void SwitchTag_InverseBitInMask() { var expectedState = !textTagsState.IsInTag(TagName.Em); textTagsState = textTagsState.SwitchTag(TagName.Em); textTagsState.IsInTag(TagName.Em).Should().Be(expectedState); }
private bool IsItLooksLikeTag(TagName tag, TextTagsState state) { const int moreThanAnyTagLength = 4; if (state.Start + Tags.GetMd(tag).Length - 1 > state.End || IsDisabledEscape(state)) { return(false); } if (state.Start + moreThanAnyTagLength <= state.End && state.Text.Substring(state.Start, moreThanAnyTagLength) == "____") { return(false); } var potentialTag = state.Text.Substring(state.Start, Tags.GetMd(tag).Length); return(Tags.GetMd(tag) == potentialTag && !state.IsInTag(TagName.Em) && !state.IsInTag(TagName.StrongEm)); }
public bool TestIsInTag(TagName tagName) => textTagsState.IsInTag(tagName);