Beispiel #1
0
        public void TestFlags()
        {
            EContext ctx = EContext.Unlimited;

            try {
                ctx.Flags = 5;
                Assert.Fail("Should have failed");
            } catch (InvalidOperationException) {
                new Object();
            } catch (Exception ex) {
                Assert.Fail(ex.ToString());
                throw new InvalidOperationException(String.Empty, ex);
            }
            ctx = ctx.WithBlankFlags();
            try {
                ctx.Flags = 5;
            } catch (Exception ex) {
                Assert.Fail(ex.ToString());
                throw new InvalidOperationException(String.Empty, ex);
            }
            ctx = ctx.WithNoFlags();
            try {
                ctx.Flags = 5;
                Assert.Fail("Should have failed");
            } catch (InvalidOperationException) {
                new Object();
            } catch (Exception ex) {
                Assert.Fail(ex.ToString());
                throw new InvalidOperationException(String.Empty, ex);
            }
        }