public void GenerateString_Throws_AEx(uint length, char[] validCharacters, bool removeDuplicates) { using (var rngesus = new RNGesus()) { Assert.Throws <ArgumentException>(() => rngesus.GenerateString(length, validCharacters, removeDuplicates)); } }
public void GenerateString_ValidCharactersCharArray_DoesNotThrow(int length, char[] validCharacters, bool removeDuplicates) { using (var rngesus = new RNGesus()) { Assert.DoesNotThrow(() => rngesus.GenerateString(length, validCharacters, removeDuplicates)); } }
public void GenerateString_DoesNotThrow(int length) { using (var rngesus = new RNGesus()) { Assert.DoesNotThrow(() => rngesus.GenerateString(length)); } }
public void Ctor_Works_Undersized_Buffer(int bufferSize, int length) { using (var rngesus = new RNGesus(bufferSize)) { Assert.DoesNotThrow(() => rngesus.GenerateString(length)); } }
public void Ctor_Throws_AooREx(int bufferSize, int length) { using (var rngesus = new RNGesus(bufferSize)) { Assert.Throws <ArgumentOutOfRangeException>(() => rngesus.GenerateString(length)); } }
public void SharedBufferTest() { const int iterations = 999; var integerResults = new int[iterations]; var longResults = new long[iterations]; var boolResults = new bool[iterations]; var floatResults = new float[iterations]; var doubleResults = new double[iterations]; var byteResults = new byte[iterations][]; var stringResults = new string[iterations]; using (var rngesus = new RNGesus()) { for (var i = 0; i < iterations; i++) { integerResults[i] = rngesus.GenerateInt(); } for (var i = 0; i < iterations; i++) { longResults[i] = rngesus.GenerateLong(); } for (var i = 0; i < iterations; i++) { boolResults[i] = rngesus.GenerateBool(); } for (var i = 0; i < iterations; i++) { floatResults[i] = rngesus.GenerateFloat(); } for (var i = 0; i < iterations; i++) { doubleResults[i] = rngesus.GenerateDouble(); } for (var i = 0; i < iterations; i++) { byteResults[i] = rngesus.GenerateByteArray(99); } for (var i = 0; i < iterations; i++) { stringResults[i] = rngesus.GenerateString(99); } } Assert.That(integerResults.Length == iterations); Assert.That(longResults.Length == iterations); Assert.That(boolResults.Length == iterations); Assert.That(floatResults.Length == iterations); Assert.That(doubleResults.Length == iterations); Assert.That(byteResults.Length == iterations); Assert.That(stringResults.Length == iterations); }
public void GenerateString_ValidCharactersString_ReturnsCorrectLength(uint length, char[] validCharacters, bool removeDuplicates) { using (var rngesus = new RNGesus()) { var result = rngesus.GenerateString(length, validCharacters, removeDuplicates); Assert.That((result.Length == length)); } }
public void GenerateString_ReturnsCorrectLength(uint length) { using (var rngesus = new RNGesus()) { var result = rngesus.GenerateString(length); Assert.That((result.Length == length)); } }
public void LockTest() { var result = ""; using (var rngesus = new RNGesus(9999)) { result = rngesus.GenerateString(rngesus.GenerateInt(999, 9999)); } Assert.That(result.Length >= 999); Assert.That(result.Length <= 9999); }
public void GenerateString_ValidCharactersString_ReturnsNoDuplicates(uint length, char[] validCharacters, bool removeDuplicates) { var results = new string[99]; for (var i = 0; i < results.Length; i++) { using (var rngesus = new RNGesus()) { results[i] = rngesus.GenerateString(length, validCharacters, removeDuplicates); } } Assert.That(results.Distinct().Count() == results.Count()); }
public void GenerateString_ReturnsNoDuplicates() { var results = new string[99]; for (var i = 0; i < results.Length; i++) { using (var rngesus = new RNGesus()) { results[i] = rngesus.GenerateString(99); } } Assert.That(results.Distinct().Count() == results.Count()); }