public void GetCharacter_ReturnsEmptyString_WhenCharacterClassIsEmpty() { var charClassEmpty = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); var result = charClassEmpty.GetRandomCharacter(); Assert.AreEqual(string.Empty, result); }
public void GetCharacter_ReturnsFirstCharacter_WhenCharacterClassContainsSingleCharacter() { var charClassF = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); charClassF.AddCharacters(new List <string> { "F" }); var result = charClassF.GetRandomCharacter(); Assert.AreEqual("F", result); _randomGenerator.Received(0).GetNextInteger(Arg.Any <int>(), Arg.Any <int>()); }
public void GetCharacter_ReturnsThirdCharacter_WhenCharacterClassContainsThreeCharactersAndRandomGeneratorReturns2() { _randomGenerator.GetNextInteger(Arg.Any <int>(), Arg.Any <int>()).Returns(2); var charClassF = new CharacterClassExpression(_alphabet, _randomGenerator, _maxInverseLength); charClassF.AddCharacters(new List <string> { "F", "r", "a" }); var result = charClassF.GetRandomCharacter(); Assert.AreEqual("a", result); _randomGenerator.Received(1).GetNextInteger(Arg.Any <int>(), Arg.Any <int>()); }