public ActionResult Details(int id)
        {
            var model   = new ProjectFormModel();
            var project = ProjectRepository.ProjectFetch(id);

            model.Title       = string.Format("Project {0}", project.Name);
            model.Project     = project;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Project);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Sprints           = SprintRepository.SprintFetchInfoList(project);
            model.Statuses          = StatusRepository.StatusFetchInfoList(id);
            model.Stories           = StoryRepository.StoryFetchInfoList(project, false);
            model.Users             = ProjectUserRepository.ProjectUserFetchInfoList(id);
            model.TimelineListModel = new TimelineListModel
            {
                Timelines    = TimelineRepository.TimelineFetchInfoList(project),
                SourceId     = project.SourceId,
                SourceTypeId = (int)project.SourceType
            };
            model.Actions.Add("Edit this project", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add a story", Url.Action("Create", "Story", new { projectId = id }));
            model.Actions.Add("Add a sprint", Url.Action("Create", "Sprint", new { projectId = id }));
            model.Actions.Add("Add an email", string.Empty);
            model.Actions.Add("Add a note", Url.Action("Create", "Note", new { sourceId = id, sourceTypeId = (int)SourceType.Project }));
            model.Actions.Add("Add a collaborator", Url.Action("Create", "ProjectUser", new { projectId = id }));
            model.Actions.Add("Add a status", Url.Action("Create", "Status", new { projectId = id }));

            return(this.View(model));
        }
Beispiel #2
0
        public void GetByIdAsync_Sprint_ShouldWork_WhithCorrectId()
        {
            //Arrange
            var cls     = new InMemoryAppDbContext();
            var context = cls.GetContextWithData();

            try
            {
                ISprintRepository repository = new SprintRepository(context);
                //Act
                Sprint expected  = context.Sprints.Find(1);
                Sprint actual    = repository.GetByIdAsync(1).Result;
                Sprint expected2 = context.Sprints.Find(2);
                Sprint actual2   = repository.GetByIdAsync(2).Result;
                //Assert
                Assert.Equal(expected, actual);
                Assert.Equal(expected2, actual2);

                Assert.Equal(expected.Id, actual.Id);
                Assert.Equal(expected.ProjectId, actual.ProjectId);
                Assert.Equal(expected.StartDate, actual.StartDate);
            }
            finally
            {
                context.Database.EnsureDeleted();
                context.Dispose();
            }
        }
Beispiel #3
0
        public void CreateAsync_ShouldCreateManySprints(int id, int projectId)
        {
            //Arrange
            var cls     = new InMemoryAppDbContext();
            var context = cls.GetContextWithData();

            try
            {
                ISprintRepository repository = new SprintRepository(context);
                Sprint            sprint     = new Sprint {
                    Id = id, ProjectId = projectId, StartDate = new DateTime(2020, 4, 23), EndDate = new DateTime(2020, 5, 23)
                };
                //Act
                repository.CreateAsync(sprint);
                var actual = context.Sprints.Find(id);
                //Assert
                Assert.Equal(sprint.Id, actual.Id);
                Assert.Equal(sprint.ProjectId, actual.ProjectId);
                Assert.Equal(sprint.StartDate, actual.StartDate);
                Assert.Equal(sprint.EndDate, actual.EndDate);
            }
            finally
            {
                context.Database.EnsureDeleted();
                context.Dispose();
            }
        }
Beispiel #4
0
        public void UpdateAsync_ShouldUpdateSprint()
        {
            //Arrange
            var cls     = new InMemoryAppDbContext();
            var context = cls.GetContextWithData();

            try
            {
                ISprintRepository repository = new SprintRepository(context);
                Sprint            sprint     = context.Sprints.Find(1);
                sprint.ProjectId = 2;
                //Act
                repository.UpdateAsync(sprint);
                var actual = context.Sprints.Find(1);
                //Assert
                Assert.Equal(sprint.Id, actual.Id);
                Assert.NotEqual(1, actual.ProjectId);
                Assert.Equal(sprint.ProjectId, actual.ProjectId);
            }
            finally
            {
                context.Database.EnsureDeleted();
                context.Dispose();
            }
        }
 public SprintCommandHandler(SprintRepository sprintRepository, ISprintFactory sprintFactory, ISprintSearcher sprintSearcher, IIssueSearcher issueSearcher)
 {
     this.sprintRepository = sprintRepository;
     this.sprintFactory    = sprintFactory;
     this.sprintSearcher   = sprintSearcher;
     this.issueSearcher    = issueSearcher;
 }
Beispiel #6
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryFetch(id);
            var project = ProjectRepository.ProjectFetch(story.ProjectId);

            this.Map(collection, story);

            story = StoryRepository.StorySave(story);

            if (story.IsValid)
            {
                return(this.RedirectToAction("Details", new { id = story.StoryId }));
            }

            model.Title    = "Story Edit";
            model.Story    = story;
            model.Sprints  = SprintRepository.SprintFetchInfoList(project);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId);

            ModelHelper.MapBrokenRules(this.ModelState, story);

            return(this.View(model));
        }
        //
        // GET: /Sprint/
        public ActionResult Index()
        {
            int productId  = Int32.Parse(Session["ProductId"].ToString());
            var sprintRepo = new SprintRepository();

            bool isSprintActive;
            var  tasks = sprintRepo.GetCurrentSprintTasks(productId, out isSprintActive);

            if (tasks == null)
            {
                return(View(new SprintModel {
                    IsSprintActive = false
                }));
            }

            var model = new SprintModel()
            {
                TodoItems          = tasks.Where(x => x.TaskStatus == DomainClasses.Enums.TaskStatus.Open).ToList(),
                InDevelopmentItems = tasks.Where(x => x.TaskStatus == DomainClasses.Enums.TaskStatus.Development).ToList(),
                InTestingItems     = tasks.Where(x => x.TaskStatus == DomainClasses.Enums.TaskStatus.Testing).ToList(),
                DoneItems          = tasks.Where(x => x.TaskStatus == DomainClasses.Enums.TaskStatus.Closed).ToList(),
                IsSprintActive     = isSprintActive
            };

            return(View(model));
        }
Beispiel #8
0
        public void CreateAsync_ShouldWork(int id, int projectId)
        {
            //Arrange
            var cls     = new InMemoryAppDbContext();
            var context = cls.GetContextWithData();

            try
            {
                ISprintRepository repository = new SprintRepository(context);
                //Act
                Sprint sprint = new Sprint {
                    Id = id, ProjectId = projectId
                };
                repository.CreateAsync(sprint);
                var actual = context.Sprints.Find(id);
                //Assert
                Assert.NotNull(actual);
                Assert.Equal(sprint.Id, actual.Id);
                Assert.Equal(sprint.ProjectId, actual.ProjectId);
            }
            finally
            {
                context.Database.EnsureDeleted();
                context.Dispose();
            }
        }
        // GET api/sprint
        // get data for sprint task pie chart
        public IEnumerable <_SprintTasksPieChartModel> Get(int id)
        {
            bool isSprinActive;
            var  repo        = new SprintRepository();
            var  sprintTasks = repo.GetCurrentSprintTasks(id, out isSprinActive);

            return(_SprintTasksPieChartModel.GetData(sprintTasks));
        }
Beispiel #10
0
        public static Sprint SprintAdd()
        {
            var sprint = SprintTestHelper.SprintNew();

            sprint = SprintRepository.SprintSave(sprint);

            return(sprint);
        }
Beispiel #11
0
 public UnitOfWork(DatabaseContext context)
 {
     _context = context;
     Projects = new ProjectRepository(_context);
     Sprints  = new SprintRepository(_context);
     Users    = new UserRepository(_context);
     Tasks    = new TaskRepository(_context);
 }
Beispiel #12
0
        public void Sprint_Fetch_Info_List()
        {
            SprintTestHelper.SprintAdd();
            SprintTestHelper.SprintAdd();

            var sprints = SprintRepository.SprintFetchInfoList(new SprintDataCriteria());

            Assert.IsTrue(sprints.Count() > 1, "Row returned should be greater than one");
        }
Beispiel #13
0
 public IssueFactory(UserRepository userRepository, ILabelsSearcher labelsSearcher, SprintRepository sprintRepository, IMembershipService authorizationService, ProjectRepository projectRepository, CallContext callContext)
 {
     this.userRepository       = userRepository;
     this.labelsSearcher       = labelsSearcher;
     this.sprintRepository     = sprintRepository;
     this.authorizationService = authorizationService;
     this.projectRepository    = projectRepository;
     this.callContext          = callContext;
 }
Beispiel #14
0
        public void Sprint_Fetch()
        {
            var sprint = SprintTestHelper.SprintNew();

            sprint = SprintRepository.SprintSave(sprint);

            sprint = SprintRepository.SprintFetch(sprint.SprintId);

            Assert.IsTrue(sprint != null, "Row returned should not equal null");
        }
        public ActionResult Create(int projectId)
        {
            var model  = new SprintFormModel();
            var sprint = SprintRepository.SprintNew(projectId);

            model.Title  = "Sprint Create";
            model.Sprint = sprint;

            return(this.View(model));
        }
Beispiel #16
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context    = context;
     Teams       = new TeamRepository(context);
     Users       = new ApplicationUserRepository(context);
     Sprints     = new SprintRepository(context);
     Estimations = new EstimationRepository(context);
     ScrumTasks  = new ScrumTaskRepository(context);
     Events      = new EventRepository(context);
 }
        public ActionResult Edit(int id)
        {
            var model  = new SprintFormModel();
            var sprint = SprintRepository.SprintFetch(id);

            model.Title  = "Sprint Edit";
            model.Sprint = sprint;

            return(this.View(model));
        }
Beispiel #18
0
        public static Sprint SprintNew()
        {
            var project = ProjectTestHelper.ProjectAdd();

            var sprint = SprintRepository.SprintNew(project.ProjectId);

            sprint.Name = DataHelper.RandomString(50);

            return(sprint);
        }
Beispiel #19
0
        public void Sprint_Add()
        {
            var sprint = SprintTestHelper.SprintNew();

            Assert.IsTrue(sprint.IsValid, "IsValid should be true");

            sprint = SprintRepository.SprintSave(sprint);

            Assert.IsTrue(sprint.SprintId != 0, "SprintId should be a non-zero value");

            SprintRepository.SprintFetch(sprint.SprintId);
        }
        public RepositoryProvider(ScrummyDatabase database)
        {
            _database = database;

            Person   = new PersonRepository(_database.PersonCollection);
            Project  = new ProjectRepository(_database.ProjectCollection, _database.MeetingCollection, _database.SprintCollection, _database.WorkTaskCollection, _database.DocumentCollection);
            Team     = new TeamRepository(_database.TeamCollection);
            Meeting  = new MeetingRepository(_database.MeetingCollection);
            Sprint   = new SprintRepository(_database.SprintCollection, _database.ProjectCollection);
            WorkTask = new WorkTaskRepository(_database.WorkTaskCollection);
            Document = new DocumentRepository(_database.DocumentCollection, _database.SprintCollection, _database.MeetingCollection, _database.WorkTaskCollection);
        }
        public void Usage_scenario()
        {
            const string eventStoreFolderPath = "SprintRepoTest";

            if (Directory.Exists(eventStoreFolderPath))
            {
                Directory.Delete(eventStoreFolderPath, true);
            }
            var es = new FilesystemEventStore(eventStoreFolderPath);

            es.OnAppended += events => {
                foreach (var e in events)
                {
                    Console.WriteLine(e.Name);
                }
            };

            var sut = new SprintRepository(es);

            // Sprint anlegen
            var sprint   = sut.Create(new[] { "a", "b", "c" });
            var sprintId = sprint.Id;

            // Sprint laden
            sprint = sut.Load(sprintId);
            Assert.AreEqual(new[] { "a", "b", "c" }, sprint.UserStories);

            // Voting abgeben
            sprint.Register(new Voting("v1", new[] { 0, 1, 2 }));
            sut.Store(sprint);

            // Sprint laden und Voting überprüfen
            sprint = sut.Load(sprintId);
            Assert.AreEqual(1, sprint.Votings.Length);
            Assert.AreEqual(new[] { 0, 1, 2 }, sprint.Votings[0].UserStoryIndexes);

            // weiteres Voting abgeben und bisheriges überschreiben
            sprint.Register(new Voting("v2", new[] { 2, 1, 0 }));
            sprint.Register(new Voting("v1", new[] { 1, 2, 0 }));
            sut.Store(sprint);

            // Votings überprüfen
            sprint = sut.Load(sprintId);
            Assert.AreEqual(2, sprint.Votings.Length);
            Assert.AreEqual("v1", sprint.Votings[0].VoterId);
            Assert.AreEqual(new[] { 1, 2, 0 }, sprint.Votings[0].UserStoryIndexes);
            Assert.AreEqual("v2", sprint.Votings[1].VoterId);
            Assert.AreEqual(new[] { 2, 1, 0 }, sprint.Votings[1].UserStoryIndexes);

            // Sprint löschen
            sut.Delete(sprintId);
            Assert.Throws <InvalidOperationException>(() => sut.Load(sprintId));
        }
Beispiel #22
0
        public CreateSprintViewModel()
        {
            // Set sprint repository
            _sprintRepository = new SprintRepository();

            // Make commands
            MakeBacklogItemsCommand();
            MakeShowSprintsCommand();
            MakeShowBoardCommand();
            MakeShowSingleProjectCommand();
            CreateAddNewSprintCommand();
            MakeShowProjectSettingsCommand();
        }
        public ActionResult Delete(int id)
        {
            var model  = new DeleteModel();
            var sprint = SprintRepository.SprintFetch(id);

            model.Title          = "Sprint Delete";
            model.Id             = sprint.SprintId;
            model.Name           = "Sprint";
            model.Description    = sprint.Name;
            model.ControllerName = "Sprint";
            model.BackUrl        = Url.Action("Details", "Sprint", new { id = sprint.SprintId });

            return(this.View(model));
        }
Beispiel #24
0
        public ActionResult Edit(int id)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryFetch(id);
            var project = ProjectRepository.ProjectFetch(story.ProjectId);

            model.Title    = "Story Edit";
            model.Story    = story;
            model.Sprints  = SprintRepository.SprintFetchInfoList(project);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId);

            return(this.View(model));
        }
        public SprintRepositoryTests()
        {
            //Connection
            var connection = new SqliteConnection("datasource=:memory:");

            connection.Open();

            //Context
            var builder = new DbContextOptionsBuilder <ScrumContext>().UseSqlite(connection);
            var context = new ScrumTestContext(builder.Options);

            context.Database.EnsureCreated();

            _sprintRepository = new SprintRepository(context);
        }
Beispiel #26
0
        public static string FetchSprintName(int sprintId)
        {
            if (sprintId == 0)
            {
                return(string.Empty);
            }

            try
            {
                return(SprintRepository.SprintFetch(sprintId).Name);
            }
            catch (Exception)
            {
                return("Unknown");
            }
        }
        public ActionResult Create(Sprint model)
        {
            try
            {
                var sprintRepo = new SprintRepository();
                int productId  = Int32.Parse(Session["ProductId"].ToString());

                sprintRepo.AddSprint(model, productId);

                return(RedirectToAction("Index", "Backlog"));
            }
            catch
            {
                return(View(model));
            }
        }
Beispiel #28
0
        public ActionResult Create(int projectId, int?sprintId)
        {
            var model   = new StoryFormModel();
            var story   = StoryRepository.StoryNew();
            var project = ProjectRepository.ProjectFetch(projectId);

            story.ProjectId = projectId;
            story.SprintId  = sprintId ?? 0;

            model.Title    = "Story Create";
            model.Story    = story;
            model.Sprints  = SprintRepository.SprintFetchInfoList(project);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId);

            return(this.View(model));
        }
        public SprintViewModel()
        {
            // Set sprint repository
            _sprintRepository  = new SprintRepository();
            _projectRepository = new ProjectRepository();

            // set new observable collection
            Sprints = new ObservableCollection <SprintModel>();

            // Make commands
            MakeBacklogItemsCommand();
            MakeShowSprintsCommand();
            MakeShowBoardCommand();
            MakeShowSingleProjectCommand();
            MakeCreateSprintCommand();
            CreateDeleteSprintCommand();
            MakeShowSprintCommand();
            MakeShowProjectSettingsCommand();
        }
        public ActionResult Details(int id)
        {
            var model  = new SprintFormModel();
            var sprint = SprintRepository.SprintFetch(id);

            model.Title       = string.Format("Sprint {0}", sprint.Name);
            model.Sprint      = sprint;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Sprint);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Statuses = StatusRepository.StatusFetchInfoList(sprint.ProjectId);
            model.Stories  = StoryRepository.StoryFetchInfoList(sprint);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(sprint.ProjectId);
            model.Actions.Add("Edit this sprint", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add a story", Url.Action("Create", "Story", new { projectId = sprint.ProjectId, sprintId = id }));
            model.Actions.Add("Add an email", string.Empty);
            model.Actions.Add("Add a note", Url.Action("Create", "Note", new { sourceId = id, sourceTypeId = (int)SourceType.Sprint }));

            return(this.View(model));
        }
Beispiel #31
0
 public SprintsController()
 {
     _sprintRepository = new SprintRepository(SessionUser);
     _sprintRepository.OnChange += SyncManager.OnChange;
 }