public void ShouldGenerateRandomCodes() { var length = 6; var command = new GenerateCodeCommand(); var codes = new List <string> { command.Execute(length), command.Execute(length), command.Execute(length), command.Execute(length), }; Assert.True(codes.Distinct().Count() == codes.Count()); }
public void ShouldGenerateValidLengthCode() { var length = 6; var command = new GenerateCodeCommand(); var code = command.Execute(length); Assert.Equal(length, code.Length); }
public void ShouldGenerateValidAlphanumericCode() { var length = 6; var command = new GenerateCodeCommand(); var code = command.Execute(length); Assert.True(code.All(x => char.IsLetterOrDigit(x))); }
public void ShouldGenerateInvalidLengthCode() { var length = 8; var command = new GenerateCodeCommand(); var code = command.Execute(length); var validator = new CodeValidator(); Assert.False(validator.Execute(code)); }