Ejemplo n.º 1
0
    public bool PosTest2()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest2: Two return value is not equal with two instance");

        try
        {
            UTF8Encoding utf8a = new UTF8Encoding(true);
            UTF8Encoding utf8b = new UTF8Encoding(true, true);

            if (utf8a.GetHashCode() == utf8b.GetHashCode())
            {
                TestLibrary.TestFramework.LogError("002.1", "Method GetHashCode Err.");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Ejemplo n.º 2
0
    public bool PosTest2()
    {
        bool retVal = true;

        // Add your scenario description here
        TestLibrary.TestFramework.BeginScenario("PosTest2: Two return value is not equal with two instance");

        try
        {
            UTF8Encoding utf8a = new UTF8Encoding(true);
            UTF8Encoding utf8b = new UTF8Encoding(true,true);

            if (utf8a.GetHashCode() == utf8b.GetHashCode())
            {
                TestLibrary.TestFramework.LogError("002.1", "Method GetHashCode Err.");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
        public void PosTest2()
        {
            UTF8Encoding utf8a = new UTF8Encoding(true);
            UTF8Encoding utf8b = new UTF8Encoding(true, true);

            Assert.NotEqual(utf8a.GetHashCode(), utf8b.GetHashCode());
        }
        public void PosTest1()
        {
            UTF8Encoding utf8a = new UTF8Encoding();
            UTF8Encoding utf8b = utf8a;

            Assert.Equal(utf8a.GetHashCode(), utf8b.GetHashCode());
        }
Ejemplo n.º 5
0
 public void EqualsTest(UTF8Encoding encoding, object value, bool expected)
 {
     Assert.Equal(expected, encoding.Equals(value));
     if (value is UTF8Encoding)
     {
         Assert.Equal(expected, encoding.GetHashCode().Equals(value.GetHashCode()));
     }
 }
Ejemplo n.º 6
0
    public static void Main()
    {
        // Many ways to instantiate a UTF8 encoding.
        UTF8Encoding UTF8a = new UTF8Encoding();
        Encoding     UTF8b = Encoding.UTF8;
        Encoding     UTF8c = new UTF8Encoding(true, true);
        Encoding     UTF8d = new UTF8Encoding(false, false);

        // But not all are the same.
        Console.WriteLine(UTF8a.GetHashCode());
        Console.WriteLine(UTF8b.GetHashCode());
        Console.WriteLine(UTF8c.GetHashCode());
        Console.WriteLine(UTF8d.GetHashCode());
    }
Ejemplo n.º 7
0
 public void Equals(UTF8Encoding encoding, object value, bool expected)
 {
     Assert.Equal(expected, encoding.Equals(value));
     if (value is UTF8Encoding)
     {
         Assert.Equal(expected, encoding.GetHashCode().Equals(value.GetHashCode()));
     }
 }
Ejemplo n.º 8
0
 public void PosTest2()
 {
     UTF8Encoding utf8a = new UTF8Encoding(true);
     UTF8Encoding utf8b = new UTF8Encoding(true, true);
     Assert.NotEqual(utf8a.GetHashCode(), utf8b.GetHashCode());
 }
Ejemplo n.º 9
0
 public void PosTest1()
 {
     UTF8Encoding utf8a = new UTF8Encoding();
     UTF8Encoding utf8b = utf8a;
     Assert.Equal(utf8a.GetHashCode(), utf8b.GetHashCode());
 }