public string GetRandom(enRandomType type, int length, double from, double to) { int seed = DateTime.Now.Millisecond; if (length < 0 && type != enRandomType.Guid && type != enRandomType.Numbers) { throw new ArgumentException(ErrorResource.InvalidLength); } switch (type) { case enRandomType.Letters: return(GenerateLetters(length, ref seed)); case enRandomType.Numbers: return(GenerateNumbers(from, to, ref seed)); case enRandomType.LetterAndNumbers: return(GenerateMixed(length, ref seed)); case enRandomType.Guid: return(Guid.NewGuid().ToString()); default: return(null); } }
public string GetRandom(enRandomType type, int length, double from, double to) { int seed = DateTime.Now.Millisecond; if (length < 0 && type != enRandomType.Guid && type != enRandomType.Numbers) { throw new ArgumentException("length must be greater than or equal to zero if the type is Letters or LettersAndNumbers"); } switch (type) { case enRandomType.Letters: return(GenerateLetters(length, ref seed)); case enRandomType.Numbers: return(GenerateNumbers(from, to, ref seed)); case enRandomType.LetterAndNumbers: return(GenerateMixed(length, ref seed)); case enRandomType.Guid: return(Guid.NewGuid().ToString()); default: return(null); } }
void SetupArguments(string currentDL, string testData, enRandomType randomType, string from, string to, string length, string result) { TestStartNode = new FlowStep { Action = new DsfRandomActivity { RandomType = randomType, From = from, To = to, Length = length, Result = result } }; CurrentDl = testData; TestData = currentDL; }
public string GetRandom(enRandomType type, int length, int from, int to) { int seed = DateTime.Now.Millisecond; if ((length < 0 && type != enRandomType.Guid && type != enRandomType.Numbers)) { throw new ArgumentException(); } switch (type) { case enRandomType.Letters: return GenerateLetters(length, ref seed); case enRandomType.Numbers: return GenerateNumbers(from, to, ref seed); case enRandomType.LetterAndNumbers: return GenerateMixed(length, ref seed); case enRandomType.Guid: return Guid.NewGuid().ToString(); default: return null; } }
public string GetRandom(enRandomType type, int length, double from, double to) { int seed = DateTime.Now.Millisecond; if ((length < 0 && type != enRandomType.Guid && type != enRandomType.Numbers)) { throw new ArgumentException("length must be greater than or equal to zero if the type is Letters or LettersAndNumbers"); } switch (type) { case enRandomType.Letters: return GenerateLetters(length, ref seed); case enRandomType.Numbers: return GenerateNumbers(from, to, ref seed); case enRandomType.LetterAndNumbers: return GenerateMixed(length, ref seed); case enRandomType.Guid: return Guid.NewGuid().ToString(); default: return null; } }
void AddDebugInputItem(string lengthExpression, string fromExpression, string toExpression, IExecutionEnvironment executionEnvironment, enRandomType randomType, int update) { AddDebugInputItem(new DebugItemStaticDataParams(randomType.GetDescription(), "Random")); if (randomType == enRandomType.Guid) { return; } if (randomType == enRandomType.Numbers) { AddDebugInputItem(new DebugEvalResult(fromExpression, "From", executionEnvironment, update)); AddDebugInputItem(new DebugEvalResult(toExpression, "To", executionEnvironment, update)); } else { AddDebugInputItem(new DebugEvalResult(lengthExpression, "Length", executionEnvironment, update)); } }
private void AddDebugInputItem(string lengthExpression, string fromExpression, string toExpression, IBinaryDataListEntry fromEntry, IBinaryDataListEntry toEntry, IBinaryDataListEntry lengthEntry, Guid executionId, enRandomType randomType) { AddDebugInputItem(new DebugItemStaticDataParams(randomType.GetDescription(), "Random")); if (randomType == enRandomType.Guid) { return; } if (randomType == enRandomType.Numbers) { AddDebugInputItem(new DebugItemVariableParams(fromExpression, "From", fromEntry, executionId)); AddDebugInputItem(new DebugItemVariableParams(toExpression, "To", toEntry, executionId)); } else { AddDebugInputItem(new DebugItemVariableParams(lengthExpression, "Length", lengthEntry, executionId)); } }