예제 #1
0
        public void Query_EmptyStore_Returns0Departments()
        {
            IDepartmentQueryRepository sut = GetSut();
            var departments = sut.Query();

            Assert.True(departments.Count() == 0);
        }
예제 #2
0
        public void Query_WithFilterOnId_Returns1Departments()
        {
            var id1          = Guid.NewGuid();
            var committeeId1 = Guid.NewGuid();
            var id2          = Guid.NewGuid();
            var committeeId2 = Guid.NewGuid();
            var streamData   = new List <Tuple <string, Guid, long, IEnumerable <IEvent> > >
            {
                new Tuple <string, Guid, long, IEnumerable <IEvent> >(departmentTag, id1, 0, new List <IEvent>
                {
                    new NewDepartmentEvent(id1, "Test Department 1"),
                    new NewCommitteeEvent(committeeId1, "Test Committee 1", "mandate")
                }),
                new Tuple <string, Guid, long, IEnumerable <IEvent> >(departmentTag, id2, 0, new List <IEvent>
                {
                    new NewDepartmentEvent(id2, "Test Department 2"),
                    new NewCommitteeEvent(committeeId2, "Test Committee 2", "mandate")
                })
            };
            IDepartmentQueryRepository sut = GetSut(streamData);
            var departments = sut.Query(x => x.Id == id2);

            Assert.True(departments.Count() == 1);
            Assert.Equal("Test Department 2", departments.First().Name);
        }
예제 #3
0
        public IActionResult Index()
        {
            var departments = _departmentQueryRepository
                              .Query()
                              .Select(Mapper.Map <DepartmentViewModel>);

            return(View(departments));
        }