public void DataPortalExecute_OnCommandObjectWithFalseExecuteMethod_ThrowsExeptionMehodNotFound() { try { Csla.ApplicationContext.GlobalContext.Clear(); Csla.Server.FactoryDataPortal.FactoryLoader = null; var test = CommandObjectMissingFactoryMethod.Execute(); } catch (DataPortalException ex) { // inner exception should be System.NotImplementedException and mesaage should contain methodname Assert.AreEqual(typeof(System.NotImplementedException), ex.InnerException.GetType()); Assert.IsTrue(ex.InnerException.Message.Contains("ExecuteMissingMethod")); // rethrow exception throw; } Assert.Fail("Should throw exception"); }
public void DataPortalExecute_OnCommandObjectWithFalseExecuteMethod_ThrowsExeptionMehodNotFound() { TestDIContext testDIContext = TestDIContextFactory.CreateDefaultContext(); IDataPortal <CommandObjectMissingFactoryMethod> dataPortal = testDIContext.CreateDataPortal <CommandObjectMissingFactoryMethod>(); try { TestResults.Reinitialise(); var test = CommandObjectMissingFactoryMethod.Execute(dataPortal); } catch (DataPortalException ex) { // inner exception should be System.NotImplementedException and mesaage should contain methodname Assert.AreEqual(typeof(System.NotImplementedException), ex.InnerException.GetType()); Assert.IsTrue(ex.InnerException.Message.Contains("ExecuteMissingMethod")); // rethrow exception throw; } Assert.Fail("Should throw exception"); }