UpdateEventTypesAndTimers() public method

public UpdateEventTypesAndTimers ( ) : void
return void
コード例 #1
0
ファイル: TestProject.cs プロジェクト: LongoMatch/longomatch
        public void TestUpdateEventTypesAndTimers()
        {
            ProjectLongoMatch p = new ProjectLongoMatch ();
            p.Dashboard = DashboardLongoMatch.DefaultTemplate (5);
            Assert.AreEqual (0, p.Timers.Count);
            Assert.AreEqual (0, p.EventTypes.Count);
            p.UpdateEventTypesAndTimers ();
            Assert.AreEqual (1, p.Timers.Count);
            Assert.AreEqual (10, p.EventTypes.Count);

            // Delete a category button with no events
            p.Dashboard.List.Remove (p.Dashboard.List.OfType<AnalysisEventButton> ().First ());
            p.UpdateEventTypesAndTimers ();
            Assert.AreEqual (1, p.Timers.Count);
            Assert.AreEqual (9, p.EventTypes.Count);

            // Delete a category button with events in the timeline
            AnalysisEventButton button = p.Dashboard.List.OfType<AnalysisEventButton> ().First ();
            p.Timeline.Add (new TimelineEventLongoMatch { EventType = button.EventType });
            p.UpdateEventTypesAndTimers ();
            Assert.AreEqual (1, p.Timers.Count);
            Assert.AreEqual (9, p.EventTypes.Count);
            p.Dashboard.List.Remove (button);
            p.UpdateEventTypesAndTimers ();
            Assert.AreEqual (1, p.Timers.Count);
            Assert.AreEqual (9, p.EventTypes.Count);

            // Remove the event from the timeline, the event type is no longuer in the dashboard or the timeline
            p.Timeline.Clear ();
            p.UpdateEventTypesAndTimers ();
            Assert.AreEqual (1, p.Timers.Count);
            Assert.AreEqual (8, p.EventTypes.Count);
        }
コード例 #2
0
ファイル: TestProject.cs プロジェクト: LongoMatch/longomatch
        ProjectLongoMatch CreateProject(bool fill = true)
        {
            ProjectLongoMatch p = new ProjectLongoMatch ();
            p.Dashboard = DashboardLongoMatch.DefaultTemplate (10);
            p.UpdateEventTypesAndTimers ();
            p.LocalTeamTemplate = SportsTeam.DefaultTemplate (10);
            p.VisitorTeamTemplate = SportsTeam.DefaultTemplate (12);
            MediaFile mf = new MediaFile ("path", 34000, 25, true, true, "mp4", "h264",
                               "aac", 320, 240, 1.3, null, "Test asset");
            var pd = new ProjectDescription ();
            pd.FileSet = new MediaFileSet ();
            pd.FileSet.Add (mf);
            p.Description = pd;
            if (fill) {
                p.AddEvent (p.EventTypes [0], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [0], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [1], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [2], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [2], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [2], new Time (1000), new Time (2000), null, null);
                p.AddEvent (p.EventTypes [6], new Time (1000), new Time (2000), null, null);
            }

            return p;
        }
コード例 #3
0
 ProjectLongoMatch CreateProject()
 {
     var project = new ProjectLongoMatch { Description = new ProjectDescription () };
     project.LocalTeamTemplate = App.Current.TeamTemplatesProvider.Templates.FirstOrDefault (t => t.Name == "spain");
     Assert.IsNotNull (project.LocalTeamTemplate);
     project.VisitorTeamTemplate = App.Current.TeamTemplatesProvider.Templates.FirstOrDefault (t => t.Name == "france");
     Assert.IsNotNull (project.VisitorTeamTemplate);
     project.Dashboard = App.Current.CategoriesTemplatesProvider.Templates.FirstOrDefault (t => t.Name == "basket") as DashboardLongoMatch;
     Assert.IsNotNull (project.Dashboard);
     project.Description.Competition = "Liga";
     project.Description.MatchDate = DateTime.UtcNow;
     project.Description.Description = "Created by LongoMatch";
     project.Description.Season = "2015-2016";
     project.Description.LocalName = project.LocalTeamTemplate.TeamName;
     project.Description.VisitorName = project.VisitorTeamTemplate.TeamName;
     project.Description.FileSet = new MediaFileSet ();
     project.Description.FileSet.Add (new MediaFile {
         FilePath = "Test.mp4",
         Duration = new Time { TotalSeconds = 60000 }
     });
     project.UpdateEventTypesAndTimers ();
     return project;
 }