Ejemplo n.º 1
0
        public async Task StartSprint(ISprintSearcher sprintSearcher)
        {
            if (Status != SprintStatus.Planned)
            {
                throw new CannotChangeSprintStatus(Id, Status, SprintStatus.InProgress, DomainInformationProvider.Name);
            }

            var sprints = await sprintSearcher.GetSprints(ProjectId);

            if (sprints.Any(x => x.Status == SprintStatus.InProgress))
            {
                throw new CannotStartSprintWhenAnyOtherIsNotFinished(Id);
            }

            var currentDate = DateTime.UtcNow.Date;

            if (StartDate.Date != currentDate)
            {
                StartDate = currentDate;
            }

            Status = SprintStatus.InProgress;
            Update(new SprintStarted(Id, Status, StartDate));
        }
        public async Task <IReadOnlyCollection <SprintListItem> > HandleAsync(GetSprints query)
        {
            var sprints = await sprintSearcher.GetSprints(query.ProjectId, query.NotFinishedOnly);

            return(sprints.Select(x => new SprintListItem(x.Id, x.Name, x.Start, x.End, x.Status)).ToList());
        }