public void empty_string_produces_no_conditions() { var text = string.Empty; var actual = CharacterCondition.Parse(text); actual.Should().BeEmpty(); }
public void invalid_condition_creates_empty_result() { var text = "[x"; var actual = CharacterCondition.Parse(text); actual.Should().BeEmpty(); }
public void empty_negated_range_allows_any() { var text = "[^]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.Should().BeEmpty(); actual[0].Restricted.Should().BeTrue(); }
public void multiple_letter_in_brackets_creates_allowed_multiple() { var text = "[qwerty]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.ShouldBeEquivalentTo("qwerty".ToCharArray()); actual[0].Restricted.Should().BeFalse(); }
public void single_letter_in_brackets_creates_single_char() { var text = "[b]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.ShouldBeEquivalentTo(new[] { 'b' }); actual[0].Restricted.Should().BeFalse(); }
public void empty_brackets_creates_disallowed_condition() { var text = "[]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.Should().BeEmpty(); actual[0].Restricted.Should().BeFalse(); }
public void single_dot_allows_anything() { var text = "."; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.Should().BeEmpty(); actual[0].Restricted.Should().BeTrue(); }
public void double_caret_negated_range_allows_all_but_caret() { var text = "[^^]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.ShouldBeEquivalentTo(new[] { '^' }); actual[0].Restricted.Should().BeTrue(); }
public void multiple_in_negated_range_allows_all_but_specified() { var text = "[^qwerty]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.ShouldBeEquivalentTo("qwerty".ToCharArray()); actual[0].Restricted.Should().BeTrue(); }
public void single_in_negated_range_allows_all_but_one() { var text = "[^t]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(1); actual[0].Characters.ShouldBeEquivalentTo(new[] { 't' }); actual[0].Restricted.Should().BeTrue(); }
public void documentation_example_creates_correct_conditions() { var text = "[^aeiou]y"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(2); actual[0].Characters.ShouldBeEquivalentTo("aeiou".ToCharArray()); actual[0].Restricted.Should().BeTrue(); actual[1].Characters.ShouldBeEquivalentTo(new[] { 'y' }); actual[1].Restricted.Should().BeFalse(); }
public void two_mixed_ranges_makes_two__restricted_conditions() { var text = "[qwerty][^asdf]"; var actual = CharacterCondition.Parse(text); actual.Should().HaveCount(2); actual[0].Characters.ShouldBeEquivalentTo("qwerty".ToCharArray()); actual[0].Restricted.Should().BeFalse(); actual[1].Characters.ShouldBeEquivalentTo("asdf".ToCharArray()); actual[1].Restricted.Should().BeTrue(); }