public void CompareTest() { string testString1 = MFUtilities.GetRandomString(); string testString2 = MFUtilities.GetRandomString(); String.Compare(testString1, testString2); }
public MFTestResults TextFlow_LineCountTest2() { if (CleaningWindow() != MFTestResults.Pass) { return(MFTestResults.Fail); } Log.Comment("This test gives unpredictable result, skipping it for the moment"); MFTestResults testResult = MFTestResults.Skip; count = 10; int _maxFontWidth = _font.AverageWidth; int _minCharsinaLine = _width / _maxFontWidth; int len = (11 * _minCharsinaLine) / 10; _longStr = MFUtilities.GetRandomString(len); _lineCount = true; UpdateWindow(); txtFlow.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(SetTopLine), null); if (txtFlow.LineCount != count + 2) { Log.Comment("Expectd Line count " + count + 2 + " but got " + txtFlow.LineCount); //testResult = MFTestResults.Fail; } _lineCount = false; return(testResult); }
public void VerifyWrite() { // limit to 512 bytes because of potential // buffer issues with larger strings. int length = new Random().Next(512); string data = MFUtilities.GetRandomString(length); Log.FilteredComment("Using string: '" + data + "'"); this.VerifyWrite(data); }
public TestObj() { Random rand = new Random(DateTime.Now.Millisecond); this.Count = rand.Next(); this.uCount = (uint)rand.Next(); this.LongCount = rand.Next(); this.uLongCount = (ulong)rand.Next(); this.Double = rand.NextDouble(); this.byteArray = new byte[1024]; rand.NextBytes(this.byteArray); this.charArray = MFUtilities.GetRandomString().ToCharArray(); this.Data = new string(this.charArray); }
public MFTestResults Ssid() { int MAX_SSID_LENGTH = 31; char[] specialChars = { '~', '/', '`', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '-', '+', '=', '{', '[', '}', ']', '|', '\\', ':', ';', '"', '\'', }; char[] specialChars2 = { '<', ',', '>', '.', '?', '/' }; string[] testStrings = { " ", MFUtilities.GetRandomSafeString(1), MFUtilities.GetRandomSafeString(MAX_SSID_LENGTH), MFUtilities.GetRandomString(1), MFUtilities.GetRandomString(MAX_SSID_LENGTH), MFUtilities.GetRandomHighByteString(1), MFUtilities.GetRandomHighByteString(8), "?˜???", "??????", "0x0001fd94", new string(specialChars), new string(specialChars2), }; string[] invalidStrings = { MFUtilities.GetRandomSafeString(MAX_SSID_LENGTH + 1), MFUtilities.GetRandomString(MAX_SSID_LENGTH + 1), MFUtilities.GetRandomString(MAX_SSID_LENGTH + 1 + new Random().Next(100)), }; foreach (string testString in testStrings) { try { SetSsid(testString); // Verify. if (MFTestResults.Fail == VerifySsid(testString)) { return(MFTestResults.Fail); } } catch (Exception ex) { Log.Exception(ex.Message); return(MFTestResults.Fail); } } foreach (string invalidString in invalidStrings) { try { SetSsid(invalidString); Log.Comment("Setting ssid to " + invalidString + " succeeded. " + " Expected an exception to be thrown. Returning a failure."); return(MFTestResults.Fail); } catch (Exception ex) { Log.Comment("Test passed - A valid exception was thrown: " + ex.Message); } } SetSsid("SSID_1"); // Return test result. return(MFTestResults.Pass); }
public void LengthTest() { string testString = MFUtilities.GetRandomString(); int length = testString.Length; }