コード例 #1
0
        public void TestCircularDepdencies()
        {
            DashboardLongoMatch dashboard = new DashboardLongoMatch ();
            DashboardButton b1 = new DashboardButton ();
            DashboardButton b2 = new DashboardButton ();
            DashboardButton b3 = new DashboardButton ();
            dashboard.List.Add (b1);
            dashboard.List.Add (b2);
            dashboard.List.Add (b3);

            b1.AddActionLink (new ActionLink { DestinationButton = b2 });
            Assert.IsFalse (dashboard.HasCircularDependencies ());
            b2.AddActionLink (new ActionLink { DestinationButton = b3 });
            Assert.IsFalse (dashboard.HasCircularDependencies ());
            b3.AddActionLink (new ActionLink { DestinationButton = b1 });
            Assert.IsTrue (dashboard.HasCircularDependencies ());
        }
コード例 #2
0
        public void RemoveDeadLinks()
        {
            DashboardLongoMatch dashboard = new DashboardLongoMatch ();
            AnalysisEventButton b1 = dashboard.AddDefaultItem (0);
            AnalysisEventButton b2 = dashboard.AddDefaultItem (1);

            b1.ActionLinks.Add (new ActionLink { DestinationButton = b2 });
            dashboard.RemoveDeadLinks (b2);
            Assert.AreEqual (1, b1.ActionLinks.Count);

            b1.ActionLinks [0].DestinationTags = new ObservableCollection<Tag> { b2.AnalysisEventType.Tags [0] };
            dashboard.RemoveDeadLinks (b2);
            Assert.AreEqual (1, b1.ActionLinks.Count);

            b2.AnalysisEventType.Tags.Remove (b2.AnalysisEventType.Tags [1]);
            dashboard.RemoveDeadLinks (b2);
            Assert.AreEqual (1, b1.ActionLinks.Count);
            b2.AnalysisEventType.Tags.Remove (b2.AnalysisEventType.Tags [0]);
            dashboard.RemoveDeadLinks (b2);
            Assert.AreEqual (0, b1.ActionLinks.Count);
        }
コード例 #3
0
 public ProjectLongoMatch()
 {
     Dashboard = new DashboardLongoMatch ();
     LocalTeamTemplate = new SportsTeam ();
     VisitorTeamTemplate = new SportsTeam ();
 }
コード例 #4
0
        public void TestSerialization()
        {
            DashboardLongoMatch cat = new DashboardLongoMatch ();

            Utils.CheckSerialization (cat);

            cat.Name = "test";
            cat.GamePeriods = new ObservableCollection<string> { "1", "2" };
            cat.List.Add (new AnalysisEventButton { Name = "cat1" });
            cat.List.Add (new AnalysisEventButton { Name = "cat2" });
            cat.List.Add (new AnalysisEventButton { Name = "cat3" });

            Utils.CheckSerialization (cat);

            DashboardLongoMatch newcat = Utils.SerializeDeserialize (cat);
            Assert.AreEqual (cat.ID, newcat.ID);
            Assert.AreEqual (cat.Name, newcat.Name);
            Assert.AreEqual (cat.GamePeriods.Count, newcat.GamePeriods.Count);
            Assert.AreEqual (cat.GamePeriods [0], newcat.GamePeriods [0]);
            Assert.AreEqual (cat.GamePeriods [1], newcat.GamePeriods [1]);
            Assert.AreEqual (cat.List.Count, newcat.List.Count);
        }
コード例 #5
0
        public void TestRemoveButton()
        {
            DashboardLongoMatch dashboard = new DashboardLongoMatch ();
            DashboardButton b1 = new DashboardButton ();
            DashboardButton b2 = new DashboardButton ();
            DashboardButton b3 = new DashboardButton ();
            dashboard.List.Add (b1);
            dashboard.List.Add (b2);
            dashboard.List.Add (b3);

            b1.ActionLinks.Add (new ActionLink { DestinationButton = b2 });
            b2.ActionLinks.Add (new ActionLink { DestinationButton = b3 });
            b3.ActionLinks.Add (new ActionLink { DestinationButton = b1 });

            dashboard.RemoveButton (b3);
            Assert.AreEqual (0, b2.ActionLinks.Count);
            dashboard.RemoveButton (b2);
            Assert.AreEqual (0, b1.ActionLinks.Count);
        }