public HttpResponseMessage Get(string id) { var projectQueryService = new ProjectQueryService(); var getProjectByIdQuery = new GetProjectByIdQuery(id); var project = projectQueryService.Execute(getProjectByIdQuery); return(Request.CreateResponse(HttpStatusCode.OK, project)); }
public HttpResponseMessage Get() { var projectQueryService = new ProjectQueryService(); var getProjectsQuery = new GetProjectsQuery(); var projects = projectQueryService.Execute(getProjectsQuery); return(Request.CreateResponse(HttpStatusCode.OK, projects)); }
public void Project_Does_Not_Already_Exist() { var doesProjectWithTitleExistQuery = new DoesProjectWithTitleExistQuery(_title); var projectQueryService = new ProjectQueryService(); bool doesProjectExist = projectQueryService.Handle(doesProjectWithTitleExistQuery); Assert.That(doesProjectExist, Is.False); }
public void Project_Does_Already_Exist() { using (var session = DocumentStore.OpenSession()) { var projectId = Fixture.Create <ProjectId>(); var projectTreeNode = new ProjectTreeNode(projectId, _title, Fixture.Create <DateTime>().ToShortDateString(), ProjectPriority.Low.DisplayName, 0); session.Store(projectTreeNode); session.SaveChanges(); } var doesProjectWithTitleExistQuery = new DoesProjectWithTitleExistQuery(_title); var projectQueryService = new ProjectQueryService(); bool doesProjectExist = projectQueryService.Handle(doesProjectWithTitleExistQuery); Assert.That(doesProjectExist, Is.True); }