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 }
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 }
public static void TestHasFlag(Enum flag, bool expected) { Int32Enum e = (Int32Enum)0x3f06; bool b = e.HasFlag(flag); Assert.Equal(expected, b); }