Esempio n. 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
    }
Esempio n. 2
0
        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
        }
Esempio n. 3
0
    public static void TestHasFlag(Enum flag, bool expected)
    {
        Int32Enum e = (Int32Enum)0x3f06;

        bool b = e.HasFlag(flag);

        Assert.Equal(expected, b);
    }