Beispiel #1
0
        public void TestToggleFlagWithEnum()
        {
            ExX realX = ExX.A | ExX.C | ExX.D;
            ExX x     = realX.ToggleFlag(false, ExX.C);

            Assert.IsTrue((x & ExX.A) == ExX.A, "Expected: true, because A is set in x");
            Assert.IsFalse((x & ExX.C) == ExX.C, "Expected: false, because C should be cleared from x");
            Assert.IsTrue((x & ExX.D) == ExX.D, "Expected: true, because D is set in x");
            Assert.IsFalse((x & ExX.B) == ExX.B, "Expected: false, because B was not set at x");
            x = realX.ToggleFlag(true, ExX.B);
            Assert.IsTrue((x & ExX.B) == ExX.B, "Expected: true, because B was now set at x");

            x = realX.ToggleFlag(true, ExX.None);
            Assert.IsTrue(x == realX);
            x = realX.ToggleFlag(false, ExX.None);
            Assert.IsTrue(x == realX);
        }
Beispiel #2
0
        public void TestToggleFlagWithEnumExpectException()
        {
            ExX realX = ExX.A | ExX.C | ExX.D;

            realX.ToggleFlag(false, X.C);
        }