Ejemplo n.º 1
0
        DisasterClusterCoordinatorsViewModel GetDisasterClusterCoordinatorsViewModel(Disaster disaster)
        {
            var clusterCoordinators = _clusterCoordinatorService.GetAllCoordinators(disaster.Id);
            var disasterClusterCoordinatorsViewModel =
                new DisasterClusterCoordinatorsViewModel
            {
                DisasterName = disaster.Name,
                DisasterId   = disaster.Id,
                Clusters     = _cluster
                               .GetList()
                               .Select(c => new ClusterViewModel
                {
                    Name         = c.Name,
                    Coordinators = clusterCoordinators
                                   .Where(x => x.ClusterId == c.Id)
                                   .Select(x => new ClusterCoordinatorViewModel
                    {
                        Name = x.Person.FullName,
                        Id   = x.Id,
                    })
                                   .ToList(),
                })
                               .ToList(),
                AvailableClusters = _cluster.GetList().ToList(),
                AvailablePeople   = _dataService.Persons.ToList(),
            };

            return(disasterClusterCoordinatorsViewModel);
        }
        public void Assign_a_user_and_verify_results()
        {
            _clusterCoordinatorService.AssignClusterCoordinator(_disaster.Id, _clusterId, _person.Id);

            var clusterCoordinators = _clusterCoordinatorService.GetAllCoordinators(_disaster.Id);

            Assert.IsTrue(clusterCoordinators.Any(c => c.DisasterId == _disaster.Id && c.ClusterId == _clusterId && c.PersonId == _person.Id));
            Assert.IsTrue(_dataService.ClusterCoordinatorLogEntries.Any(c => c.DisasterId == _disaster.Id &&
                                                                        c.ClusterId == _clusterId &&
                                                                        c.PersonId == _person.Id &&
                                                                        c.Event == ClusterCoordinatorEvents.Assigned));
        }