public void ExecuteAsyncWithException() { var lck = new AutoResetEvent(false); new Action(async() => { IDataPortal <SingleCommand> dataPortal = _testDIContext.CreateDataPortal <SingleCommand>(); try { var cmd = dataPortal.Create(555); var result = await dataPortal.ExecuteAsync(cmd); Assert.Fail("Expected exception not thrown"); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(Csla.DataPortalException)); } finally { lck.Set(); } }).Invoke(); lck.WaitOne(); }
public async Task ExecuteCommand_called_without_UserState_results_in_UserState_defaulted_to_Null_server() { IDataPortal <CommandObject> dataPortal = _testDIContext.CreateDataPortal <CommandObject>(); var command = dataPortal.Create(); var result = await dataPortal.ExecuteAsync(command); Assert.AreEqual("Executed", result.AProperty); }
public async Task ExecuteAsync() { IDataPortal <SingleCommand> dataPortal = _testDIContext.CreateDataPortal <SingleCommand>(); SingleCommand cmd = dataPortal.Create(123); var result = await dataPortal.ExecuteAsync(cmd); Assert.IsNotNull(result); Assert.AreEqual(124, result.Value); }
public async Task BeginFetch_sends_cultureinfo_to_dataportal() { IDataPortal <AsyncPortalWithCulture> dataPortal = _testDIContext.CreateDataPortal <AsyncPortalWithCulture>(); string expectedCulture = Thread.CurrentThread.CurrentCulture.Name; string expectedUICulture = Thread.CurrentThread.CurrentUICulture.Name; var command = dataPortal.Create(); var result = await dataPortal.ExecuteAsync(command); Assert.AreEqual(expectedCulture, result.CurrentCulture); Assert.AreEqual(expectedUICulture, result.CurrentUICulture); }