public void TestClearAll() { Project p = Utils.CreateProject(); try { EventsFilter filter = new EventsFilter(p); filter.FilterPlayer(p.LocalTeamTemplate.List [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisiblePlayers.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(10, filter.VisiblePlayers.Count); filter.FilterEventType(p.EventTypes [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisibleEventTypes.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(13, filter.VisibleEventTypes.Count); filter.FilterEventTag(p.EventTypes [0], (p.EventTypes [0] as AnalysisEventType).Tags [0], true); Assert.AreEqual(0, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisibleEventTypes.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(13, filter.VisibleEventTypes.Count); } finally { Utils.DeleteProject(p); } }
public void TestFilterPlayersDuplicated() { LMProject p = Utils.CreateProject(); p.VisitorTeamTemplate = p.LocalTeamTemplate; try { EventsFilter filter = new EventsFilter(p); Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); foreach (LMPlayer player in p.LocalTeamTemplate.List) { filter.FilterPlayer(player, true); } Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); foreach (LMPlayer player in p.VisitorTeamTemplate.List) { filter.FilterPlayer(player, true); } Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); filter.ClearAll(); Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); } finally { Utils.DeleteProject(p); } }
public void TestFilterCategoryTags() { Project p = Utils.CreateProject(); try { EventsFilter filter = new EventsFilter(p); AnalysisEventType a; Assert.AreEqual(3, filter.VisiblePlays.Count); a = p.EventTypes [0] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [0], true); Assert.AreEqual(1, filter.VisibleEventTypes.Count); Assert.AreEqual(0, filter.VisiblePlays.Count); a = p.EventTypes [1] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [0], true); Assert.AreEqual(2, filter.VisibleEventTypes.Count); Assert.AreEqual(1, filter.VisiblePlays.Count); a = p.EventTypes [2] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [0], true); Assert.AreEqual(3, filter.VisibleEventTypes.Count); Assert.AreEqual(1, filter.VisiblePlays.Count); filter.FilterEventTag(a, a.Tags [1], true); Assert.AreEqual(2, filter.VisiblePlays.Count); a = p.EventTypes [0] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [0], false); Assert.AreEqual(3, filter.VisiblePlays.Count); a = p.EventTypes [1] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [0], false); filter.FilterEventTag(a, a.Tags [1], true); Assert.AreEqual(2, filter.VisiblePlays.Count); Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]); Assert.AreEqual(p.Timeline [2], filter.VisiblePlays [1]); /* One tag filtered now, but not the one of this play */ a = p.EventTypes [2] as AnalysisEventType; filter.FilterEventTag(a, a.Tags [1], false); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]); /* No more tags filtered, if the category matches we are ok */ filter.FilterEventTag(a, a.Tags [0], false); Assert.AreEqual(2, filter.VisiblePlays.Count); Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]); Assert.AreEqual(p.Timeline [2], filter.VisiblePlays [1]); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); } finally { Utils.DeleteProject(p); } }