public void TestSerialization() { ProjectLongoMatch p = new ProjectLongoMatch (); Utils.CheckSerialization (p); p = CreateProject (); Utils.CheckSerialization (p); p.AddEvent (new TimelineEventLongoMatch ()); Utils.CheckSerialization (p); ProjectLongoMatch newp = Utils.SerializeDeserialize (p); Assert.AreEqual (newp.CompareTo (p), 0); Assert.AreEqual (newp.Timeline.Count, p.Timeline.Count); }
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; }
List<ProjectLongoMatch> CreateProjects() { PlayerLongoMatch andoni = new PlayerLongoMatch { Name = "Andoni" }; PlayerLongoMatch jorge = new PlayerLongoMatch { Name = "Jorge" }; PlayerLongoMatch victor = new PlayerLongoMatch { Name = "Victor" }; PlayerLongoMatch josep = new PlayerLongoMatch { Name = "Josep" }; PlayerLongoMatch davide = new PlayerLongoMatch { Name = "Davide" }; PlayerLongoMatch saray = new PlayerLongoMatch { Name = "Saray" }; PlayerLongoMatch ivan = new PlayerLongoMatch { Name = "Ivan" }; PlayerLongoMatch adria = new PlayerLongoMatch { Name = "Adria" }; SportsTeam devteam = new SportsTeam { Name = "DevTeam" }; SportsTeam qateam = new SportsTeam { Name = "QA" }; devteam.List.AddRange (new List<PlayerLongoMatch> { andoni, jorge, victor, josep, davide }); qateam.List.AddRange (new List<PlayerLongoMatch> { saray, ivan, adria }); DashboardLongoMatch dashbaord = DashboardLongoMatch.DefaultTemplate (5); var projects = new List<ProjectLongoMatch> (); for (int i = 0; i < 5; i++) { ProjectLongoMatch p = new ProjectLongoMatch (); p.Dashboard = dashbaord.Clone (); p.LocalTeamTemplate = devteam; p.VisitorTeamTemplate = qateam; p.Description = new ProjectDescription (); foreach (var player in devteam.List.Concat (qateam.List)) { foreach (var button in p.Dashboard.List.OfType<AnalysisEventButton> ()) { TimelineEventLongoMatch evt = p.AddEvent (button.EventType, new Time (0), new Time (10), new Time (5), null) as TimelineEventLongoMatch; evt.Players.Add (player); if (qateam.List.Contains (player)) { evt.Teams.Add (qateam); } else { evt.Teams.Add (devteam); } } } projects.Add (p); storage.Store (p); } return projects; }