public void RegisterContext2() { try { var m = new MetaModel(); m.RegisterContext(typeof(Bar)); // not supported } finally { MetaModel.ResetRegistrationException(); } }
public void RegisterContext3() { var m = new MetaModel(); try { // no public constructor m.RegisterContext(typeof(DataContext)); } finally { MetaModel.ResetRegistrationException(); } }
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(); } }
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(); } }