public void GetUnion_ReturnsCharactersJ_WhenCharacterClassContainsJndIsUnitedWithEmptyCharClass() { var charClassJA = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); charClassJA.AddCharacters(new List <string> { "J" }); var result = charClassJA.GetUnion(new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength)); Assert.AreEqual("J", result.GetRandomCharacter()); }
public void GetUnion_ReturnsCharactersJAN_WhenCharacterClassContainsJAAndIsUnitedWithCharacterClassContainingAN() { var charClassJA = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); charClassJA.AddCharacters(new List <string> { "J", "A" }); var charClassNA = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); charClassNA.AddCharacters(new List <string> { "N", "A" }); var result = charClassJA.GetUnion(charClassNA); _randomGenerator.GetNextInteger(Arg.Any <int>(), Arg.Any <int>()).Returns(0); Assert.AreEqual("J", result.GetRandomCharacter()); _randomGenerator.GetNextInteger(Arg.Any <int>(), Arg.Any <int>()).Returns(1); Assert.AreEqual("A", result.GetRandomCharacter()); _randomGenerator.GetNextInteger(Arg.Any <int>(), Arg.Any <int>()).Returns(2); Assert.AreEqual("N", result.GetRandomCharacter()); }