public void Repetition_0ToU() { var child = ReUtils.NewDummy('1'); var element = ReFactory.NewRepetition(child, 0, null); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReKleeneStar))); var star = (ReKleeneStar)element; Assert.That(star.Element, Is.SameAs(child)); }
public void Repetition_2() { var child = ReUtils.NewDummy('1'); var element = ReFactory.NewRepetition(child, 2, 2); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReConcatenation))); var concat = (ReConcatenation)element; Assert.That(concat.Elements, Is.EquivalentTo(new ReElement[] { child, child })); }
public void Repetition_0To1() { var child = ReUtils.NewDummy('1'); var element = ReFactory.NewRepetition(child, 0, 1); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReUnion))); var elements = new List <ReElement>(((ReUnion)element).Elements); Assert.That(elements.Count, Is.EqualTo(2)); Assert.That(elements[0], Is.SameAs(child)); Assert.That(elements[1], Is.Not.Null); Assert.That(elements[1], Is.TypeOf(typeof(ReEmptyString))); }
public void Repetition_1ToU() { var child = ReUtils.NewDummy('1'); var element = ReFactory.NewRepetition(child, 1, null); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReConcatenation))); var concatElements = new List <ReElement>(((ReConcatenation)element).Elements); Assert.That(concatElements.Count, Is.EqualTo(2)); Assert.That(concatElements[0], Is.SameAs(child)); Assert.That(concatElements[1], Is.Not.Null); Assert.That(concatElements[1], Is.TypeOf(typeof(ReKleeneStar))); var star = (ReKleeneStar)concatElements[1]; Assert.That(star.Element, Is.SameAs(child)); }