예제 #1
0
    public static void TestHasFlagInvalid()
    {
        Int32Enum e = (Int32Enum)0x3f06;

        Assert.Throws <ArgumentNullException>("flag", () => e.HasFlag(null));      // Flag is null
        Assert.Throws <ArgumentException>(null, () => e.HasFlag((SimpleEnum)0x2)); // Different enum type
    }
예제 #2
0
파일: EnumTests.cs 프로젝트: ESgarbi/corefx
        public static void HasFlag_Invalid()
        {
            Int32Enum e = (Int32Enum)0x3f06;

            Assert.Throws <ArgumentNullException>("flag", () => e.HasFlag(null));         // Flag is null
            Assert.Throws <ArgumentException>(null, () => e.HasFlag((SimpleEnum)0x3000)); // Enum is not the same type as the instance
        }
예제 #3
0
    public static void TestHasFlag(Enum flag, bool expected)
    {
        Int32Enum e = (Int32Enum)0x3f06;

        bool b = e.HasFlag(flag);

        Assert.Equal(expected, b);
    }