public void CloseProject() { var obj = ProjectEdit.NewProject(); obj.Name = "Test"; obj.Description = "This is a test"; obj.Started = DateTime.Today.Subtract(new TimeSpan(5, 0, 0)); obj = obj.Save(); var result = ProjectCloser.CloseProject(obj.Id); Assert.IsTrue(result.Closed); ProjectEdit.DeleteProject(obj.Id); }
public void CloseProjectFail() { var obj = ProjectEdit.NewProject(); obj.Name = "Test"; obj.Description = "This is a test"; obj.Started = DateTime.Today.Subtract(new TimeSpan(5, 0, 0)); obj.Ended = DateTime.Today; obj = obj.Save(); try { var result = ProjectCloser.CloseProject(obj.Id); } catch (Csla.DataPortalException ex) { throw ex.BusinessException; } finally { ProjectEdit.DeleteProject(obj.Id); } }
public void CloseProjectAsync() { var obj = ProjectEdit.NewProject(); obj.Name = "Test"; obj.Description = "This is a test"; obj.Started = DateTime.Today.Subtract(new TimeSpan(5, 0, 0)); obj = obj.Save(); var sync = new AutoResetEvent(false); ProjectCloser.CloseProject(obj.Id, (o, e) => { if (e.Error != null) { Assert.Fail(e.Error.Message); } var result = e.Object; Assert.IsTrue(result.Closed); }); sync.WaitOne(1000); ProjectEdit.DeleteProject(obj.Id); }