예제 #1
0
 public void RegisterContext2()
 {
     try {
         var m = new MetaModel();
         m.RegisterContext(typeof(Bar));                   // not supported
     } finally {
         MetaModel.ResetRegistrationException();
     }
 }
예제 #2
0
        public void RegisterContext3()
        {
            var m = new MetaModel();

            try {
                // no public constructor
                m.RegisterContext(typeof(DataContext));
            } finally {
                MetaModel.ResetRegistrationException();
            }
        }
예제 #3
0
        public void RegisterContext()
        {
            var m = new MetaModel();

            try {
                m.RegisterContext(typeof(Foo));
                Assert.Fail("#1");
            } catch (TargetInvocationException ex) {
                Assert.AreEqual("ERROR", ex.InnerException.Message, "#2");
            } finally {
                MetaModel.ResetRegistrationException();
            }
        }
예제 #4
0
        public void ResetRegistrationException()
        {
            MetaModel.ResetRegistrationException();

            var m = new MetaModel();

            try {
                m.RegisterContext(typeof(Foo));
                Assert.Fail("#1");
            } catch (TargetInvocationException) {
            }

            try {
                m.RegisterContext(typeof(MyDataContext1));
                Assert.Fail("#2");
            } catch (InvalidOperationException) {
            } finally {
                MetaModel.ResetRegistrationException();
            }
        }