System.Collections.Tests.ComparerTests.Default_Compare_Invalid C# (CSharp) Method

Default_Compare_Invalid() private method

private Default_Compare_Invalid ( ) : void
return void
        public static void Default_Compare_Invalid()
        {
            Comparer comp = Comparer.Default;
            Assert.Throws<ArgumentException>(null, () => comp.Compare(new object(), 1)); // One object doesn't implement IComparable
            Assert.Throws<ArgumentException>(null, () => comp.Compare(1, new object())); // One object doesn't implement IComparable
            Assert.Throws<ArgumentException>(null, () => comp.Compare(new object(), new object())); // Both objects don't implement IComparable

            Assert.Throws<ArgumentException>(null, () => comp.Compare(1, 1L)); // Different types
        }