Пример #1
0
        public IActionResult Details(Guid id)
        {
            var department = _departmentQueryRepository.GetById(id);
            var vm         = Mapper.Map <DepartmentViewModel>(department);

            return(View(vm));
        }
Пример #2
0
        public IActionResult Details(Guid id, Guid departmentId)
        {
            var department = _departmentQueryRepository.GetById(departmentId);
            var committee  = department.Committees.Single(x => x.Id == id);
            var vm         = Mapper.Map <CommitteeViewModel>(committee);

            vm.DepartmentId = departmentId;
            return(View(vm));
        }
Пример #3
0
        public void GetById_WithEmptyEventStore_ReturnsNull()
        {
            var id = Guid.NewGuid();
            IDepartmentQueryRepository sut = GetSut();
            var department = sut.GetById(id);

            Assert.Null(department.Name);
        }
Пример #4
0
        public void GetById_WithNewDepartment_ReturnsPopulatedDepartment()
        {
            var id          = Guid.NewGuid();
            var committeeId = Guid.NewGuid();
            var streamData  = new List <Tuple <string, Guid, long, IEnumerable <IEvent> > >
            {
                new Tuple <string, Guid, long, IEnumerable <IEvent> >(departmentTag, id, 0, new List <IEvent>
                {
                    new NewDepartmentEvent(id, "Test Department"),
                    new NewCommitteeEvent(committeeId, "Test Committee", "mandate")
                })
            };
            IDepartmentQueryRepository sut = GetSut(streamData);
            var department = sut.GetById(id);

            Assert.Equal("Test Department", department.Name);
            Assert.NotEmpty(department.Committees);
        }