protected override NestedViewModel <PlayerTimelineVM> GetSubTimeline(TimelineVM viewModel)
 {
     if (teamType == TeamType.LOCAL)
     {
         return(((LMTimelineVM)viewModel).HomeTeamTimelineVM);
     }
     else
     {
         return(((LMTimelineVM)viewModel).AwayTeamTimelineVM);
     }
 }
예제 #2
0
        public void AddEvent_FirstAndTimelineDoesNotExists_TimelineCreatedAndEventAddedToTimeline()
        {
            Project    project   = Utils.CreateProject(true);
            TimelineVM viewModel = new TimelineVM();

            viewModel.FullTimeline.ViewModels.Add(new TimelineEventVM {
                Model = project.Timeline [0]
            });

            Assert.AreEqual(project.Timeline [0], viewModel.FullTimeline.ViewModels [0].Model);
            Assert.IsTrue(viewModel.EventTypesTimeline.ViewModels.Count == 1);
        }
예제 #3
0
        public void CreateEventTypesTimeline_5EventTypesDifferentNamesNoGrouping_5TimelinesCreated()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);

            Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count);
        }
예제 #4
0
        public void Timeline_SetLimitation_SetsInFullTimeline()
        {
            TimelineVM viewModel = new TimelineVM();

            viewModel.Model = new RangeObservableCollection <TimelineEvent> ();
            var countLimitation      = new CountLimitationVM();
            var countLimitationChart = new CountLimitationBarChartVM {
                Limitation = countLimitation
            };

            viewModel.LimitationChart = countLimitationChart;

            Assert.AreSame(countLimitation, viewModel.FullTimeline.Limitation);
        }
예제 #5
0
        public void RemoveEventType_TimelineEmpty_TimelineRemoved()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            var timelinesCount = viewModel.EventTypesTimeline.Count();

            project.EventTypes.Remove(project.EventTypes [0]);

            Assert.AreEqual(timelinesCount - 1, viewModel.EventTypesTimeline.Count());
        }
예제 #6
0
        TimelineEvent AddTimelineEventWithPlayers(TimelineVM timeline, params PlayerVM [] players)
        {
            EventType evt = new EventType {
                Name = "Tests"
            };
            TimelineEvent timelineEvnt = new TimelineEvent();

            timelineEvnt.EventType = evt;
            foreach (PlayerVM p in players)
            {
                timelineEvnt.Players.Add(p.Model);
            }
            timeline.Model.Add(timelineEvnt);
            return(timelineEvnt);
        }
예제 #7
0
        public void CreateEventTypesTimeline_5EventTypes2WithSameNameGroupingEnabled_4TimelinesCreated()
        {
            Project project = Utils.CreateProject(true);

            project.EventTypes [1].Name = project.EventTypes [0].Name;
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.GroupEventsByEventTypeName = true;

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);

            Assert.AreEqual(4, viewModel.EventTypesTimeline.ViewModels.Count);
        }
예제 #8
0
        public void TestClearTimeline()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            viewModel.Model = project.Timeline;

            viewModel.Clear();

            Assert.AreEqual(0, viewModel.EventTypesTimeline.ViewModels.Count);
            Assert.AreEqual(0, viewModel.FullTimeline.ViewModels.Count);
        }
예제 #9
0
        public void TestSetModel()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            viewModel.Model = project.Timeline;

            Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count);
            Assert.AreEqual(3, viewModel.FullTimeline.ViewModels.Count);
            Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [0].Count());
            Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [1].Count());
            Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [2].Count());
        }
예제 #10
0
        public void RemoveTimelineEventVMWithPlayers_FullTimelineWithTimelineEventVMWithPlayers_FullTimelineWithoutTimelineEventVM()
        {
            // Arrange
            Project project = Utils.CreateProject(true);

            project.Timeline [0].Players.Add(new DummyPlayer());
            TimelineVM viewModel = new TimelineVM();
            var        timeLineEventViewModel = new TimelineEventVM {
                Model = project.Timeline [0]
            };

            viewModel.FullTimeline.ViewModels.Add(timeLineEventViewModel);

            // Act
            viewModel.FullTimeline.ViewModels.Remove(timeLineEventViewModel);

            // Assert
            Assert.IsFalse(viewModel.FullTimeline.ViewModels.Any());
        }
예제 #11
0
        public void RemoveEventType_TimelineNotEmpty_TimelineNotRemoved()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            viewModel.Model = project.Timeline;
            EventType eventType = project.EventTypes [0];

            project.AddEvent(eventType, new Time(0), new Time(10), new Time(5), null);
            var timelinesCount = viewModel.EventTypesTimeline.Count();

            project.EventTypes.Remove(eventType);

            Assert.AreEqual(timelinesCount, viewModel.EventTypesTimeline.Count());
        }
예제 #12
0
        public async Task SetUp()
        {
            timelineVM = new TimelineVM();

            var dealer    = new DummyProjectDealer();
            var projectvm = new DummyProjectVM {
                Model = EventsFilterUtils.CreateProject()
            };

            timelineVM.CreateEventTypeTimelines(projectvm.EventTypes);

            dealer.Project  = projectvm;
            dealer.Timeline = timelineVM;

            eventsFilterController.SetViewModel(dealer);

            CreateEvents();

            await eventsFilterController.Start();
        }
예제 #13
0
        public void TestTimelineEvent()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            viewModel.Model = project.Timeline;
            EventType eventType = project.EventTypes [0];

            Assert.AreEqual(3, viewModel.FullTimeline.ViewModels.Count);
            Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels.First(e => e.EventTypeVM.Model == eventType).Count());

            project.AddEvent(eventType, new Time(0), new Time(10), new Time(5), null);

            Assert.AreEqual(4, viewModel.FullTimeline.ViewModels.Count);
            Assert.AreEqual(2, viewModel.EventTypesTimeline.ViewModels.First(e => e.EventTypeVM.Model == eventType).Count());
        }
예제 #14
0
        public IActionResult Index()
        {
            List <TimelineVM>    model  = new List <TimelineVM>();
            List <ObjaveClanova> objave = _ctx.ObjaveClanova.OrderByDescending(x => x.DatumObjave).Include(x => x.Clan).ToList();

            foreach (var item in objave)
            {
                TimelineVM t = new TimelineVM();
                t.Objava        = item;
                t.BrojKomentara = GetBrKomentara(item.ObjaveClanovaId);
                t.Komentari     = GetKomentari(item.ObjaveClanovaId);
                t.Lajkovi       = GetLajkovi(item.ObjaveClanovaId);
                t.KoJeLajkao    = GetKoJeLajkao(t.Lajkovi, t.Objava.ObjaveClanovaId);

                model.Add(t);
            }

            ViewData["_ctx"] = _ctx;

            return(View(model));
        }
예제 #15
0
 void CreateTimelineWithTeams(out TimelineVM timeline, out TeamVM homeTeamVM, out TeamVM awayTeamVM)
 {
     homeTeamVM       = new TeamVM();
     awayTeamVM       = new TeamVM();
     homeTeamVM.Model = new DummyTeam();
     awayTeamVM.Model = new DummyTeam();
     for (int i = 0; i < 5; i++)
     {
         homeTeamVM.Model.List.Add(new Utils.PlayerDummy {
             Name = $"Player{i}"
         });
         awayTeamVM.Model.List.Add(new Utils.PlayerDummy {
             Name = $"Player{i}"
         });
     }
     timeline       = new TimelineVM();
     timeline.Model = new RangeObservableCollection <TimelineEvent> ();
     timeline.CreateTeamsTimelines(new List <TeamVM> {
         homeTeamVM, awayTeamVM
     });
 }
예제 #16
0
        public void TestRenameEventType()
        {
            Project   project   = Utils.CreateProject(true);
            ProjectVM projectVM = new DummyProjectVM {
                Model = project
            };
            TimelineVM viewModel = new TimelineVM();

            viewModel.CreateEventTypeTimelines(projectVM.EventTypes);
            viewModel.Model = project.Timeline;
            string expected = "New Name";

            EventType et = viewModel.Model.FirstOrDefault().EventType;

            et.Name = expected;
            viewModel.Model.Add(new TimelineEvent {
                EventType = et
            });

            Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count);
            Assert.AreEqual(expected, viewModel.EventTypesTimeline.ViewModels.FirstOrDefault().Model.Name);
        }
예제 #17
0
 void CheckPlayerEvents(TimelineVM timeline, PlayerVM player, int count)
 {
     Assert.AreEqual(count, timeline.TeamsTimeline.ViewModels.SelectMany(p => p.ViewModels).
                     Where(p => p.Player == player).SelectMany(p => p.ViewModels).Count());
 }
예제 #18
0
 /// <summary>
 /// Return the subtimeline used by this treeview, like the event types's or the player's treeview.
 /// </summary>
 /// <returns>The sub timeline.</returns>
 /// <param name="viewModel">View model.</param>
 protected abstract NestedViewModel <TViewModel> GetSubTimeline(TimelineVM viewModel);
 protected override NestedViewModel <EventTypeTimelineVM> GetSubTimeline(TimelineVM viewModel)
 {
     return(ViewModel.EventTypesTimeline);
 }
예제 #20
0
 public override void SetViewModel(object viewModel)
 {
     ViewModel = viewModel as TimelineVM;
 }