public bool PosTest1() { bool retVal = true; // Add your scenario description here TestLibrary.TestFramework.BeginScenario("PosTest1: Verify method Clone ."); try { NumberFormatInfo nfi1 = new NumberFormatInfo(); NumberFormatInfo nfi2 = (NumberFormatInfo)nfi1.Clone(); if (!nfi1.Equals(nfi2) && nfi1.GetHashCode() == nfi2.GetHashCode()) { TestLibrary.TestFramework.LogError("001.1", "Method Clone Err ."); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return(retVal); }
public bool PosTest1() { bool retVal = true; // Add your scenario description here TestLibrary.TestFramework.BeginScenario("PosTest1: Verify method Clone ."); try { NumberFormatInfo nfi1 = new NumberFormatInfo(); NumberFormatInfo nfi2 = (NumberFormatInfo)nfi1.Clone(); if (!nfi1.Equals(nfi2) && nfi1.GetHashCode() == nfi2.GetHashCode()) { TestLibrary.TestFramework.LogError("001.1", "Method Clone Err ."); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return retVal; }
public void TestClone() { NumberFormatInfo nfi1 = new NumberFormatInfo(); nfi1.CurrencyDecimalSeparator = "testStr"; NumberFormatInfo nfi2 = (NumberFormatInfo)nfi1.Clone(); Assert.NotEqual(nfi1.GetHashCode(), nfi2.GetHashCode()); Assert.NotEqual(nfi1, nfi2); Assert.Equal(nfi1.CurrencyDecimalDigits, nfi2.CurrencyDecimalDigits); Assert.Equal(nfi1.CurrencyDecimalSeparator, nfi2.CurrencyDecimalSeparator); Assert.Equal(nfi1.CurrencyGroupSizes, nfi2.CurrencyGroupSizes); Assert.Equal(nfi1.CurrencyGroupSeparator, nfi2.CurrencyGroupSeparator); Assert.Equal(nfi1.CurrencyNegativePattern, nfi2.CurrencyNegativePattern); Assert.Equal(nfi1.CurrencyPositivePattern, nfi2.CurrencyPositivePattern); Assert.Equal(nfi1.IsReadOnly, nfi2.IsReadOnly); }
public void Clone() { NumberFormatInfo format = new NumberFormatInfo(); format.CurrencyDecimalSeparator = "string"; NumberFormatInfo clone = (NumberFormatInfo)format.Clone(); Assert.NotEqual(format.GetHashCode(), clone.GetHashCode()); Assert.NotEqual(format, clone); Assert.NotSame(format, clone); Assert.Equal(format.CurrencyDecimalDigits, clone.CurrencyDecimalDigits); Assert.Equal(format.CurrencyDecimalSeparator, clone.CurrencyDecimalSeparator); Assert.Equal(format.CurrencyGroupSizes, clone.CurrencyGroupSizes); Assert.Equal(format.CurrencyGroupSeparator, clone.CurrencyGroupSeparator); Assert.Equal(format.CurrencyNegativePattern, clone.CurrencyNegativePattern); Assert.Equal(format.CurrencyPositivePattern, clone.CurrencyPositivePattern); Assert.Equal(format.IsReadOnly, clone.IsReadOnly); }
public override int GetHashCode() { return(_value.GetHashCode()); }