예제 #1
0
    public static void CompareEncodings(UTF32Encoding a, String name)
    {
        // Create different instances of UTF32Encoding using the ctor with three parameters.
        UTF32Encoding u32ttt = new UTF32Encoding(true, true, true);
        UTF32Encoding u32ttf = new UTF32Encoding(true, true, false);
        UTF32Encoding u32tft = new UTF32Encoding(true, false, true);
        UTF32Encoding u32tff = new UTF32Encoding(true, false, false);
        UTF32Encoding u32ftt = new UTF32Encoding(false, true, true);
        UTF32Encoding u32ftf = new UTF32Encoding(false, true, false);
        UTF32Encoding u32fft = new UTF32Encoding(false, false, true);
        UTF32Encoding u32fff = new UTF32Encoding(false, false, false);

        // Compare the specified instance with each of the instances that were just created.
        Console.WriteLine("{0} and u32ttt : {1}", name, a.Equals(u32ttt));
        Console.WriteLine("{0} and u32ttf : {1}", name, a.Equals(u32ttf));
        Console.WriteLine("{0} and u32tft : {1}", name, a.Equals(u32tft));
        Console.WriteLine("{0} and u32tff : {1}", name, a.Equals(u32tff));
        Console.WriteLine("{0} and u32ftt : {1}", name, a.Equals(u32ftt));
        Console.WriteLine("{0} and u32ftf : {1}", name, a.Equals(u32ftf));
        Console.WriteLine("{0} and u32fft : {1}", name, a.Equals(u32fft));
        Console.WriteLine("{0} and u32fff : {1}", name, a.Equals(u32fff));
    }
예제 #2
0
 public void EqualsTest(UTF32Encoding encoding, object value, bool expected)
 {
     Assert.Equal(expected, encoding.Equals(value));
     Assert.Equal(expected, encoding.GetHashCode().Equals(value?.GetHashCode()));
 }
예제 #3
0
 public void Equals(UTF32Encoding encoding, object value, bool expected)
 {
     Assert.Equal(expected, encoding.Equals(value));
     Assert.Equal(expected, encoding.GetHashCode().Equals(value?.GetHashCode()));
 }