public void TestQueryEventsByPlayerEventTypeAndProject() { Dashboard dashbaord; LMTeam devTeam, qaTeam; List <LMProject> projects; projects = CreateProjects(); dashbaord = projects [0].Dashboard; devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter(); filter.Add("Parent", projects [0], projects [1]); Assert.AreEqual(80, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Player", devTeam.List [0], qaTeam.List [1]); Assert.AreEqual(20, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", (dashbaord.List [0] as AnalysisEventButton).EventType); Assert.AreEqual(4, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Team", devTeam); var res = storage.Retrieve <LMTimelineEvent> (filter); Assert.AreEqual(2, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestQueryEventsByNoPlayerOrTeam() { LMPlayer messi = new LMPlayer { Name = "Messi" }; LMTimelineEvent evt = new LMTimelineEvent(); evt.Players.Add(messi); storage.Store(evt); evt = new LMTimelineEvent(); storage.Store(evt); QueryFilter filter = new QueryFilter(); LMPlayer nullPlayer = null; LMTeam nullTeam = null; filter.Add("Player", nullPlayer); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter = new QueryFilter(); filter.Add("Team", nullTeam); Assert.AreEqual(2, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter = new QueryFilter(); QueryFilter teamsAndPlayersFilter = new QueryFilter { Operator = QueryOperator.Or }; filter.Children.Add(teamsAndPlayersFilter); teamsAndPlayersFilter.Add("Team", nullTeam); teamsAndPlayersFilter.Add("Player", nullPlayer); filter.Operator = QueryOperator.Or; Assert.AreEqual(2, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestNestedQueries() { LMTeam devTeam, qaTeam; List <LMProject> projects; projects = CreateProjects(); devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter(); filter.Add("Parent", projects); Assert.AreEqual(200, storage.Retrieve <LMTimelineEvent> (filter).Count()); QueryFilter teamsPlayersFilter = new QueryFilter { Operator = QueryOperator.Or }; teamsPlayersFilter.Add("Team", qaTeam); filter.Children.Add(teamsPlayersFilter); Assert.AreEqual(75, storage.Retrieve <LMTimelineEvent> (filter).Count()); teamsPlayersFilter.Add("Player", devTeam.List [0]); Assert.AreEqual(100, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestIndexing() { TestView view = new TestView(storage); Assert.AreEqual(new List <string> { "Parent", "Key2", "Key1" }, view.IndexedProperties); PropertiesTest test = new PropertiesTest { Key1 = "key1", Key2 = "key2", Key3 = "key3" }; test.IsChanged = true; storage.Store(test); QueryFilter filter = new QueryFilter(); filter.Add("Key3", "key3"); Assert.Throws <InvalidQueryException> ( delegate { view.Query(filter).Count(); }); filter.Remove("Key3"); filter.Add("Key2", "key2"); Assert.AreEqual(1, view.Query(filter).Count()); }
public void TestAddOneValue() { filter.Add("Test", 4); Assert.AreEqual(1, filter.Count); Assert.AreEqual(new List <int> { 4 }, filter ["Test"]); }
public void TestQueryEventsByPlayer() { LMPlayer andoni = new LMPlayer { Name = "Andoni" }; LMPlayer jorge = new LMPlayer { Name = "Jorge" }; LMPlayer victor = new LMPlayer { Name = "Victor" }; LMPlayer josep = new LMPlayer { Name = "Josep" }; LMPlayer davide = new LMPlayer { Name = "Davide" }; LMPlayer messi = new LMPlayer { Name = "Messi" }; LMPlayer ukelele = new LMPlayer { Name = "ukelele" }; var players = new List <LMPlayer> { andoni, jorge, victor, josep, davide }; foreach (LMPlayer player in players) { LMTimelineEvent evt = new LMTimelineEvent(); evt.Players.Add(player); evt.Players.Add(messi); storage.Store(evt); } QueryFilter filter = new QueryFilter(); filter.Add("Player", messi); Assert.AreEqual(5, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Player", andoni); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Player", andoni, jorge, josep); Assert.AreEqual(3, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Player", victor, ukelele); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("Player", players); Assert.AreEqual(5, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestListProjects() { LMProject p = Utils.CreateProject(); try { p.Description.Group = "GRP"; p.Description.Competition = "COMP"; storage.Store(p); List <LMProject> projects = storage.RetrieveAll <LMProject> ().ToList(); Assert.AreEqual(1, projects.Count); Assert.AreEqual(p.Timeline.Count, projects [0].Timeline.Count); Assert.AreEqual("GRP", p.Description.Group); Assert.AreEqual("COMP", p.Description.Competition); Assert.IsTrue(projects.All(i => i.DocumentID != null)); Assert.AreEqual(1, storage.Retrieve <LMProject> (null).Count()); var filter = new QueryFilter(); filter.Add("Competition", "COMP"); Assert.AreEqual(1, storage.Retrieve <LMProject> (filter).Count()); } finally { Utils.DeleteProject(p); } }
public void TestPreload() { TestView view = new TestView(storage); Assert.AreEqual(new List <string> { "Key1", "Key3", "CreationDate" }, view.PreloadProperties); PropertiesTest test = new PropertiesTest { Key1 = "key1", Key2 = "key2", Key3 = "key3" }; test.IsChanged = true; storage.Store(test); QueryFilter filter = new QueryFilter(); filter.Add("Key2", "key2"); var test1 = view.Query(filter).First(); Assert.IsFalse(test1.IsLoaded); Assert.AreEqual(test.Key1, test1.Key1); Assert.AreEqual(test.Key3, test1.Key3); Assert.IsNull(test1.Key2); Assert.NotNull(test1.DocumentID); }
public void TestListPlayers() { foreach (string n in new [] { "andoni", "aitor", "xabi", "iñaki" }) { foreach (string f in new [] { "gorriti", "zabala", "otegui" }) { foreach (string r in new [] { "cholo", "bobi", "tolai" }) { LMPlayer p = new LMPlayer { Name = n, LastName = f, NickName = r }; storage.Store(p); } } } IEnumerable <LMPlayer> players = storage.RetrieveAll <LMPlayer> (); Assert.AreEqual(36, players.Count()); QueryFilter filter = new QueryFilter(); filter.Add("Name", "andoni"); players = storage.Retrieve <LMPlayer> (filter); Assert.AreEqual(9, players.Count()); filter = new QueryFilter(); filter.Add("Name", "andoni"); filter.Add("LastName", "zabala"); players = storage.Retrieve <LMPlayer> (filter); Assert.AreEqual(3, players.Count()); filter = new QueryFilter(); filter.Add("Name", "andoni", "aitor"); players = storage.Retrieve <LMPlayer> (filter); Assert.AreEqual(18, players.Count()); filter = new QueryFilter(); filter.Add("Name", "andoni", "aitor"); filter.Add("LastName", "zabala"); players = storage.Retrieve <LMPlayer> (filter); Assert.AreEqual(6, players.Count()); }
public void TestQueryProjects() { QueryFilter filter; foreach (string comp in new [] { "Liga", "Champions", "Copa" }) { foreach (string season in new [] { "2013", "2014", "2015" }) { foreach (string team in new [] { "Barça", "Complu", "Santomera" }) { LMProject p = new LMProject(); p.Description = new ProjectDescription(); p.Description.Season = season; p.Description.Competition = comp; p.Description.LocalName = team; p.Description.VisitorName = "Fluendo"; storage.Store(p); } } } filter = new QueryFilter(); filter.Add("Competition", "Liga"); Assert.AreEqual(9, storage.Retrieve <LMProject> (filter).Count()); filter.Add("Competition", "Liga", "Champions"); Assert.AreEqual(18, storage.Retrieve <LMProject> (filter).Count()); filter.Add("Season", "2013"); Assert.AreEqual(6, storage.Retrieve <LMProject> (filter).Count()); filter.Add("Season", "2013", "2015"); Assert.AreEqual(12, storage.Retrieve <LMProject> (filter).Count()); filter = new QueryFilter(); filter.Add("Season", "2013"); filter.Add("Competition", "Liga"); filter.Add("LocalName", "Complu"); Assert.AreEqual(1, storage.Retrieve <LMProject> (filter).Count()); filter.Add("VisitorName", "Fluendo"); Assert.AreEqual(1, storage.Retrieve <LMProject> (filter).Count()); }
private void AddEntry <TEntity>(LambdaExpression lambda, FilterUse filterUse) { if (filterUse.IsSet(FilterUse.Entities)) { EntityFilter.Add(typeof(TEntity), new EntityPredicate(lambda)); } if (filterUse.IsSet(FilterUse.Query)) { QueryFilter.Add(typeof(TEntity), new QueryPredicate <TEntity>(lambda)); } }
public void TestListElementsInProjects() { var projects = CreateProjects(); QueryFilter filter = new QueryFilter(); filter.Add("Parent", projects); Assert.AreEqual(9, storage.Retrieve <EventType> (filter).Count()); Assert.AreEqual(2, storage.Retrieve <Team> (filter).Count()); Assert.AreEqual(8, storage.Retrieve <LMPlayer> (filter).Count()); }
public bool Exists(string name) { if (systemTemplates.Any(t => t.Name == name)) { return(true); } QueryFilter filter = new QueryFilter(); filter.Add("Name", name); return(storage.Retrieve <T> (filter).Any()); }
public void TestQueryTeams() { IEnumerable <Team> teams; for (int i = 0; i < 5; i++) { var da = LMTeam.DefaultTemplate(5); da.Name = "Team" + (i + 1); storage.Store(da); } QueryFilter filter = new QueryFilter(); filter.Add("Name", "Team1"); teams = storage.Retrieve <Team> (filter); Assert.AreEqual(1, teams.Count()); Assert.AreEqual("Team1", teams.First().Name); filter.Add("Name", "Team1", "Team3"); teams = storage.Retrieve <Team> (filter); Assert.AreEqual(2, teams.Count()); Assert.IsTrue(teams.Any(d => d.Name == "Team1")); Assert.IsTrue(teams.Any(d => d.Name == "Team3")); filter = new QueryFilter(); filter.Add("Name", "Pepe"); teams = storage.Retrieve <Team> (filter); Assert.AreEqual(0, teams.Count()); filter = new QueryFilter(); filter.Add("Unkown", "Pepe"); Assert.Throws <InvalidQueryException> ( delegate { teams = storage.Retrieve <Team> (filter).ToList(); }); Assert.AreEqual(0, teams.Count()); }
public void TestQueryDashboards() { IEnumerable <Dashboard> dashboards; for (int i = 0; i < 5; i++) { var da = LMDashboard.DefaultTemplate(5); da.Name = "Dashboard" + (i + 1); storage.Store(da); } QueryFilter filter = new QueryFilter(); filter.Add("Name", "Dashboard1"); dashboards = storage.Retrieve <Dashboard> (filter); Assert.AreEqual(1, dashboards.Count()); Assert.AreEqual("Dashboard1", dashboards.First().Name); filter.Add("Name", "Dashboard1", "Dashboard3"); dashboards = storage.Retrieve <Dashboard> (filter); Assert.AreEqual(2, dashboards.Count()); Assert.IsTrue(dashboards.Any(d => d.Name == "Dashboard1")); Assert.IsTrue(dashboards.Any(d => d.Name == "Dashboard3")); filter = new QueryFilter(); filter.Add("Name", "Pepe"); dashboards = storage.Retrieve <Dashboard> (filter); Assert.AreEqual(0, dashboards.Count()); filter = new QueryFilter(); filter.Add("Unkown", "Pepe"); Assert.Throws <InvalidQueryException> ( delegate { dashboards = storage.Retrieve <Dashboard> (filter).ToList(); }); Assert.AreEqual(0, dashboards.Count()); }
public void TestQueryEventsByTeam() { LMTeam devTeam, qaTeam; List <LMProject> projects; projects = CreateProjects(); devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter(); filter.Add("Team", devTeam); Assert.AreEqual(125, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter = new QueryFilter(); filter.Add("Team", qaTeam); Assert.AreEqual(75, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestQueryEventsByEventType() { AnalysisEventType evtType1 = new AnalysisEventType { Name = "Ball lost" }; AnalysisEventType evtType2 = new AnalysisEventType { Name = "PC" }; AnalysisEventType evtType3 = new AnalysisEventType { Name = "Recovery" }; AnalysisEventType evtType4 = new AnalysisEventType { Name = "Throw-in" }; AnalysisEventType evtType5 = new AnalysisEventType { Name = "Unused" }; ScoreEventType score = new ScoreEventType { Name = "Goal" }; var eventTypes = new List <EventType> { evtType1, evtType2, evtType3, evtType4, score }; foreach (EventType evtType in eventTypes) { LMTimelineEvent evt = new LMTimelineEvent(); evt.EventType = evtType; storage.Store(evt); } QueryFilter filter = new QueryFilter(); filter.Add("EventType", evtType1); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", evtType4); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", evtType2, evtType3); Assert.AreEqual(2, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", eventTypes); Assert.AreEqual(5, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", evtType5); Assert.AreEqual(0, storage.Retrieve <LMTimelineEvent> (filter).Count()); filter.Add("EventType", score); Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count()); }
public void TestQueryDashboards() { IEnumerable<DashboardLongoMatch> dashboards; for (int i = 0; i < 5; i++) { var da = DashboardLongoMatch.DefaultTemplate (5); da.Name = "Dashboard" + (i + 1); storage.Store (da); } QueryFilter filter = new QueryFilter (); filter.Add ("Name", "Dashboard1"); dashboards = storage.Retrieve<DashboardLongoMatch> (filter); Assert.AreEqual (1, dashboards.Count ()); Assert.AreEqual ("Dashboard1", dashboards.First ().Name); filter.Add ("Name", "Dashboard1", "Dashboard3"); dashboards = storage.Retrieve<DashboardLongoMatch> (filter); Assert.AreEqual (2, dashboards.Count ()); Assert.IsTrue (dashboards.Any (d => d.Name == "Dashboard1")); Assert.IsTrue (dashboards.Any (d => d.Name == "Dashboard3")); filter = new QueryFilter (); filter.Add ("Name", "Pepe"); dashboards = storage.Retrieve<DashboardLongoMatch> (filter); Assert.AreEqual (0, dashboards.Count ()); filter = new QueryFilter (); filter.Add ("Unkown", "Pepe"); Assert.Throws<InvalidQueryException> ( delegate { dashboards = storage.Retrieve<DashboardLongoMatch> (filter).ToList (); }); Assert.AreEqual (0, dashboards.Count ()); }
public void TestQueryEventsByEventType() { AnalysisEventType evtType1 = new AnalysisEventType { Name = "Ball lost" }; AnalysisEventType evtType2 = new AnalysisEventType { Name = "PC" }; AnalysisEventType evtType3 = new AnalysisEventType { Name = "Recovery" }; AnalysisEventType evtType4 = new AnalysisEventType { Name = "Throw-in" }; AnalysisEventType evtType5 = new AnalysisEventType { Name = "Unused" }; ScoreEventType score = new ScoreEventType { Name = "Goal" }; var eventTypes = new List<EventType> { evtType1, evtType2, evtType3, evtType4, score }; foreach (EventType evtType in eventTypes) { TimelineEventLongoMatch evt = new TimelineEventLongoMatch (); evt.EventType = evtType; storage.Store (evt); } QueryFilter filter = new QueryFilter (); filter.Add ("EventType", evtType1); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", evtType4); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", evtType2, evtType3); Assert.AreEqual (2, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", eventTypes); Assert.AreEqual (5, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", evtType5); Assert.AreEqual (0, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", score); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestQueryEventsByNoPlayerOrTeam() { PlayerLongoMatch messi = new PlayerLongoMatch { Name = "Messi" }; TimelineEventLongoMatch evt = new TimelineEventLongoMatch (); evt.Players.Add (messi); storage.Store (evt); evt = new TimelineEventLongoMatch (); storage.Store (evt); QueryFilter filter = new QueryFilter (); PlayerLongoMatch nullPlayer = null; SportsTeam nullTeam = null; filter.Add ("Player", nullPlayer); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter = new QueryFilter (); filter.Add ("Team", nullTeam); Assert.AreEqual (2, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter = new QueryFilter (); QueryFilter teamsAndPlayersFilter = new QueryFilter { Operator = QueryOperator.Or }; filter.Children.Add (teamsAndPlayersFilter); teamsAndPlayersFilter.Add ("Team", nullTeam); teamsAndPlayersFilter.Add ("Player", nullPlayer); filter.Operator = QueryOperator.Or; Assert.AreEqual (2, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestQueryTeams() { IEnumerable<SportsTeam> teams; for (int i = 0; i < 5; i++) { var da = SportsTeam.DefaultTemplate (5); da.Name = "Team" + (i + 1); storage.Store (da); } QueryFilter filter = new QueryFilter (); filter.Add ("Name", "Team1"); teams = storage.Retrieve<SportsTeam> (filter); Assert.AreEqual (1, teams.Count ()); Assert.AreEqual ("Team1", teams.First ().Name); filter.Add ("Name", "Team1", "Team3"); teams = storage.Retrieve<SportsTeam> (filter); Assert.AreEqual (2, teams.Count ()); Assert.IsTrue (teams.Any (d => d.Name == "Team1")); Assert.IsTrue (teams.Any (d => d.Name == "Team3")); filter = new QueryFilter (); filter.Add ("Name", "Pepe"); teams = storage.Retrieve<SportsTeam> (filter); Assert.AreEqual (0, teams.Count ()); filter = new QueryFilter (); filter.Add ("Unkown", "Pepe"); Assert.Throws<InvalidQueryException> ( delegate { teams = storage.Retrieve<SportsTeam> (filter).ToList (); }); Assert.AreEqual (0, teams.Count ()); }
public void TestQueryEventsByPlayerEventTypeAndProject() { Dashboard dashbaord; SportsTeam devTeam, qaTeam; List<ProjectLongoMatch> projects; projects = CreateProjects (); dashbaord = projects [0].Dashboard; devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter (); filter.Add ("Parent", projects [0], projects [1]); Assert.AreEqual (80, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Player", devTeam.List [0], qaTeam.List [1]); Assert.AreEqual (20, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("EventType", (dashbaord.List [0] as AnalysisEventButton).EventType); Assert.AreEqual (4, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Team", devTeam); var res = storage.Retrieve<TimelineEventLongoMatch> (filter); Assert.AreEqual (2, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestQueryEventsByTeam() { SportsTeam devTeam, qaTeam; List<ProjectLongoMatch> projects; projects = CreateProjects (); devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter (); filter.Add ("Team", devTeam); Assert.AreEqual (125, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter = new QueryFilter (); filter.Add ("Team", qaTeam); Assert.AreEqual (75, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestListElementsInProjects() { var projects = CreateProjects (); QueryFilter filter = new QueryFilter (); filter.Add ("Parent", projects); Assert.AreEqual (9, storage.Retrieve<EventType> (filter).Count ()); Assert.AreEqual (2, storage.Retrieve<SportsTeam> (filter).Count ()); Assert.AreEqual (8, storage.Retrieve<PlayerLongoMatch> (filter).Count ()); }
public void TestNestedQueries() { SportsTeam devTeam, qaTeam; List<ProjectLongoMatch> projects; projects = CreateProjects (); devTeam = projects [0].LocalTeamTemplate; qaTeam = projects [0].VisitorTeamTemplate; QueryFilter filter = new QueryFilter (); filter.Add ("Parent", projects); Assert.AreEqual (200, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); QueryFilter teamsPlayersFilter = new QueryFilter { Operator = QueryOperator.Or }; teamsPlayersFilter.Add ("Team", qaTeam); filter.Children.Add (teamsPlayersFilter); Assert.AreEqual (75, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); teamsPlayersFilter.Add ("Player", devTeam.List [0]); Assert.AreEqual (100, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestQueryEventsByPlayer() { 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 messi = new PlayerLongoMatch { Name = "Messi" }; PlayerLongoMatch ukelele = new PlayerLongoMatch { Name = "ukelele" }; var players = new List<PlayerLongoMatch> { andoni, jorge, victor, josep, davide }; foreach (PlayerLongoMatch player in players) { TimelineEventLongoMatch evt = new TimelineEventLongoMatch (); evt.Players.Add (player); evt.Players.Add (messi); storage.Store (evt); } QueryFilter filter = new QueryFilter (); filter.Add ("Player", messi); Assert.AreEqual (5, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Player", andoni); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Player", andoni, jorge, josep); Assert.AreEqual (3, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Player", victor, ukelele); Assert.AreEqual (1, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); filter.Add ("Player", players); Assert.AreEqual (5, storage.Retrieve<TimelineEventLongoMatch> (filter).Count ()); }
public void TestQueryProjects() { QueryFilter filter; foreach (string comp in new []{"Liga", "Champions", "Copa"}) { foreach (string season in new []{"2013", "2014", "2015"}) { foreach (string team in new []{"Barça", "Complu", "Santomera"}) { ProjectLongoMatch p = new ProjectLongoMatch (); p.Description = new ProjectDescription (); p.Description.Season = season; p.Description.Competition = comp; p.Description.LocalName = team; p.Description.VisitorName = "Fluendo"; storage.Store (p); } } } filter = new QueryFilter (); filter.Add ("Competition", "Liga"); Assert.AreEqual (9, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); filter.Add ("Competition", "Liga", "Champions"); Assert.AreEqual (18, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); filter.Add ("Season", "2013"); Assert.AreEqual (6, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); filter.Add ("Season", "2013", "2015"); Assert.AreEqual (12, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); filter = new QueryFilter (); filter.Add ("Season", "2013"); filter.Add ("Competition", "Liga"); filter.Add ("LocalName", "Complu"); Assert.AreEqual (1, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); filter.Add ("VisitorName", "Fluendo"); Assert.AreEqual (1, storage.Retrieve<ProjectLongoMatch> (filter).Count ()); }