Пример #1
0
        public static ICypherFluentQuery Where(this ICypherFluentQuery query, string matchText, bool onlyLive = false)
        {
            if (!onlyLive)
            {
                return(query.Where(matchText));
            }

            return(query
                   .Where(matchText)
                   .AndWhere(string.Format("p.title in [{0}]", string.Join(", ", PathwaysConfigurationManager.GetLivePathwaysElements().Select(p => string.Format("'{0}'", p.Title))))));
        }
Пример #2
0
        public async void GetAllPathways_when_only_using_live_returns_only_live_pathways()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var liveOnlyPathways = PathwaysConfigurationManager.GetLivePathwaysElements().Select(e => e.Title);

            var res = await _pathwayRepository.GetAllPathways();

            Assert.AreEqual(res.Count(), Pathways.Count(p => liveOnlyPathways.Contains(p.Title)));
        }
Пример #3
0
        public async void GetGroupedPathways_when_only_using_live_returns_grouped_pathways()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var liveOnlyPathways         = PathwaysConfigurationManager.GetLivePathwaysElements().Select(e => e.Title);
            var liveOnlyDistinctPathways = Pathways.Where(p => p.Module == "1" && liveOnlyPathways.Contains(p.Title)).Select(p => p.Title).Distinct();

            var res = await _pathwayRepository.GetGroupedPathways();

            Assert.AreEqual(res.Count(), liveOnlyDistinctPathways.Count());
        }