protected override NestedViewModel <PlayerTimelineVM> GetSubTimeline(TimelineVM viewModel) { if (teamType == TeamType.LOCAL) { return(((LMTimelineVM)viewModel).HomeTeamTimelineVM); } else { return(((LMTimelineVM)viewModel).AwayTeamTimelineVM); } }
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); }
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); }
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); }
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()); }
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); }
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); }
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); }
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()); }
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()); }
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()); }
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(); }
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()); }
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)); }
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 }); }
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); }
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()); }
/// <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); }
public override void SetViewModel(object viewModel) { ViewModel = viewModel as TimelineVM; }