public bool PosTest1() { bool retVal = true; UnicodeEncoding expectedValue = new UnicodeEncoding(false,true); UnicodeEncoding actualValue; TestLibrary.TestFramework.BeginScenario("PosTest1:Create a instance"); try { actualValue = new UnicodeEncoding(); if (!expectedValue.Equals(actualValue)) { TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e); retVal = false; } return retVal; }
public void PosTest3() { UnicodeEncoding uEncoding = new UnicodeEncoding(); bool actualValue; actualValue = uEncoding.Equals(new TimeSpan()); Assert.False(actualValue); }
public bool PosTest1() { bool retVal = true; UnicodeEncoding uEncoding1 = new UnicodeEncoding(); UnicodeEncoding uEncoding2 = new UnicodeEncoding(false,true); bool expectedValue = true; bool actualValue; TestLibrary.TestFramework.BeginScenario("PosTest1:Invoke the method with two instance that equal."); try { actualValue = uEncoding1.Equals(uEncoding2); if (expectedValue != actualValue) { TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e); retVal = false; } return retVal; }
public bool PosTest1() { bool retVal = true; UnicodeEncoding expectedValue = new UnicodeEncoding(false, true); UnicodeEncoding actualValue; TestLibrary.TestFramework.BeginScenario("PosTest1:Create a instance"); try { actualValue = new UnicodeEncoding(); if (!expectedValue.Equals(actualValue)) { TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e); retVal = false; } return(retVal); }
public bool PosTest3() { bool retVal = true; UnicodeEncoding uEncoding = new UnicodeEncoding(); bool expectedValue = false; bool actualValue; TestLibrary.TestFramework.BeginScenario("PosTest3:Compare the instances between deference type."); try { actualValue = uEncoding.Equals(new TimeSpan()); if (expectedValue != actualValue) { TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e); retVal = false; } return(retVal); }
public bool PosTest2() { bool retVal = true; UnicodeEncoding uEncoding1 = new UnicodeEncoding(); UnicodeEncoding uEncoding2 = new UnicodeEncoding(false, false); bool expectedValue = false; bool actualValue; TestLibrary.TestFramework.BeginScenario("PosTest2:Invoke the method with two instance that not equal."); try { actualValue = uEncoding1.Equals(uEncoding2); if (expectedValue != actualValue) { TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e); retVal = false; } return(retVal); }
public void Equals(UnicodeEncoding encoding, object value, bool expected) { Assert.Equal(expected, encoding.Equals(value)); if (value is UnicodeEncoding) { Assert.Equal(expected, encoding.GetHashCode().Equals(value.GetHashCode())); } }
public void PosTest2() { UnicodeEncoding uEncoding1 = new UnicodeEncoding(); UnicodeEncoding uEncoding2 = new UnicodeEncoding(false, false); bool actualValue; actualValue = uEncoding1.Equals(uEncoding2); Assert.False(actualValue); }
public static void Main() { // Create a UnicodeEncoding without parameters. UnicodeEncoding unicode = new UnicodeEncoding(); // Create a UnicodeEncoding to support little-endian byte ordering // and include the Unicode byte order mark. UnicodeEncoding unicodeLittleEndianBOM = new UnicodeEncoding(false, true); // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. DescribeEquivalence(unicode.Equals(unicodeLittleEndianBOM)); // Create a UnicodeEncoding to support little-endian byte ordering // and not include the Unicode byte order mark. UnicodeEncoding unicodeLittleEndianNoBOM = new UnicodeEncoding(false, false); // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. DescribeEquivalence(unicode.Equals(unicodeLittleEndianNoBOM)); // Create a UnicodeEncoding to support big-endian byte ordering // and include the Unicode byte order mark. UnicodeEncoding unicodeBigEndianBOM = new UnicodeEncoding(true, true); // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. DescribeEquivalence(unicode.Equals(unicodeBigEndianBOM)); // Create a UnicodeEncoding to support big-endian byte ordering // and not include the Unicode byte order mark. UnicodeEncoding unicodeBigEndianNoBOM = new UnicodeEncoding(true, false); // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. DescribeEquivalence(unicode.Equals(unicodeBigEndianNoBOM)); }
public bool PosTest3() { bool retVal = true; UnicodeEncoding uEncoding = new UnicodeEncoding(); bool expectedValue = false; bool actualValue; TestLibrary.TestFramework.BeginScenario("PosTest3:Compare the instances between deference type."); try { actualValue = uEncoding.Equals(new TimeSpan()); if (expectedValue != actualValue) { TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e); retVal = false; } return retVal; }
public void EqualsTest(UnicodeEncoding encoding, object value, bool expected) { Assert.Equal(expected, encoding.Equals(value)); Assert.Equal(expected, encoding.GetHashCode().Equals(value?.GetHashCode())); }
public void Equals(UnicodeEncoding encoding, object value, bool expected) { Assert.Equal(expected, encoding.Equals(value)); Assert.Equal(expected, encoding.GetHashCode().Equals(value?.GetHashCode())); }