コード例 #1
0
        public async void GetIdentifiedPathway_when_only_using_live_for_valid_params_returns_pathway()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var res = await _pathwayRepository.GetIdentifiedPathway(new[] { "LPW103" }, "Male", 25);

            Assert.AreEqual(res.PathwayNo, "LPW103");
        }
コード例 #2
0
        public async void GetIdentifiedPathway_with_invalid_age_returns_null()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object, MockPathwaysWhiteListFeature.Object);

            var res = await _pathwayRepository.GetIdentifiedPathway(new[] { "PW102", "PW103" }, "Male", 10);

            Assert.IsNull(res);
        }
コード例 #3
0
        public async void GetPathway_when_only_using_live_for_valid_id_not_live_returns_null()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object, MockPathwaysWhiteListFeature.Object);

            var res = await _pathwayRepository.GetPathway("P2");

            Assert.IsNull(res);
        }
コード例 #4
0
        public async void GetAllPathways_returns_all_pathways()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object, MockPathwaysWhiteListFeature.Object);

            var res = await _pathwayRepository.GetAllPathways(true);

            Assert.AreEqual(res.Count(), Pathways.Count());
        }
コード例 #5
0
        public async void GetPathway_when_only_using_live_for_valid_id_returns_pathway()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var res = await _pathwayRepository.GetPathway("P3");

            Assert.IsNotNull(res);
            Assert.AreEqual(res.PathwayNo, "LPW102");
        }
コード例 #6
0
        public async void GetPathway_with_valid_id_returns_pathway()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var res = await _pathwayRepository.GetPathway("P2");

            Assert.IsNotNull(res);
            Assert.AreEqual(res.PathwayNo, "PW101");
        }
コード例 #7
0
        public async void GetGroupedPathways_returns_grouped_pathways()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object);

            var allDistinctPathways = Pathways.Where(p => p.Module == "1").Select(p => p.Title).Distinct();

            var res = await _pathwayRepository.GetGroupedPathways();

            Assert.AreEqual(res.Count(), allDistinctPathways.Count());
        }
コード例 #8
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)));
        }
コード例 #9
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());
        }