Beispiel #1
0
        public void ThenTeamShouldNotExist(int teamId)
        {
            Action action = () => context.Dispatcher.ExecuteQuery(new GetTeamByIdQuery(teamId));

            action.ShouldThrow <CommandExecutionException>()
            .And.Message.Should()
            .Be(CommandExecutionExceptionMessages.TeamDoesNotExist(teamId));
        }
Beispiel #2
0
        public override Team Execute(GetTeamByIdQuery query, ICommandAndQueryDispatcher dispatcher)
        {
            Team team = db.Teams
                        .Include(x => x.Owner)
                        .Include(x => x.Members.Select(m => m.User))
                        .FirstOrDefault(t => t.Id == query.TeamId);

            if (team == null)
            {
                throw new CommandExecutionException(CommandExecutionExceptionMessages.TeamDoesNotExist(query.TeamId));
            }
            return(team);
        }