Exemplo n.º 1
0
        public List <ProjectTreeNode> RetrieveAllProjects()
        {
            var allProjectTreeNodesQuery       = new AllProjectTreeNodesQuery();
            var projectTreeViewQueryHandler    = new ProjectTreeViewQueryHandler();
            List <ProjectTreeNode> allProjects = projectTreeViewQueryHandler.Handle(allProjectTreeNodesQuery);

            return(allProjects);
        }
Exemplo n.º 2
0
        public void Registered_Project_With_Deadline_Is_Added_To_Project_Tree_View()
        {
            var eventHandler      = new ProjectRegisteredEventHandler(DocumentStore);
            var projectId         = Fixture.Create <string>();
            var projectRegistered = new ProjectRegistered(projectId, Fixture.Create <string>(), ProjectPriority.Low.DisplayName, Fixture.Create <ProjectDeadline>());

            eventHandler.Handle(projectRegistered);

            var projectTreeViewQueryHandler         = new ProjectTreeViewQueryHandler();
            var allProjectTreeNodesQuery            = new AllProjectTreeNodesQuery();
            List <ProjectTreeNode> projectTreeNodes = projectTreeViewQueryHandler.Handle(allProjectTreeNodesQuery);

            Assert.That(projectTreeNodes.Any(x => x.Id == projectId));
        }
        public void Can_Retrieve_All_Projects()
        {
            var fixture = new Fixture();

            using (var session = DocumentStore.OpenSession())
            {
                string id = fixture.Create <Guid>().ToString();
                var    projectTreeNode = new ProjectTreeNode(id, fixture.Create <string>(), fixture.Create <DateTime>().ToShortDateString(),
                                                             ProjectPriority.Medium.DisplayName, 0);
                session.Store(projectTreeNode);
                session.SaveChanges();
            }

            var projectTreeViewQueryHandler         = new ProjectTreeViewQueryHandler();
            var allProjectTreeNodesQuery            = new AllProjectTreeNodesQuery();
            List <ProjectTreeNode> projectTreeNodes = projectTreeViewQueryHandler.Handle(allProjectTreeNodesQuery);

            Assert.That(projectTreeNodes.Count, Is.EqualTo(1));
        }