Пример #1
0
        public async void GetIdentifiedPathway_with_valid_params_returns_pathway()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object, MockPathwaysWhiteListFeature.Object);
            var res = await _pathwayRepository.GetIdentifiedPathway(new[] { "PW102" }, "Male", 25);

            Assert.AreEqual(res.PathwayNo, "PW102");
        }
Пример #2
0
        public async void GetIdentifiedPathway_with_invalid_age_returns_null()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(false);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.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);

            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);

            var res = await _pathwayRepository.GetAllPathways();

            Assert.AreEqual(res.Count(), Pathways.Count());
        }
Пример #5
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");
        }
Пример #6
0
        public async void GetIdentifiedPathway_when_only_using_live_for_valid_params_not_live_returns_null()
        {
            MockPathwaysConfigurationManager.Setup(m => m.UseLivePathways).Returns(true);
            _pathwayRepository = new PathwayRepository(GraphRepository, MockPathwaysConfigurationManager.Object, MockPathwaysWhiteListFeature.Object);

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

            Assert.IsNull(res);
        }
Пример #7
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");
        }
Пример #8
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, MockPathwaysWhiteListFeature.Object);

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

            Assert.IsNotNull(res);
            Assert.AreEqual(res.PathwayNo, "LPW102");
        }
Пример #9
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());
        }
Пример #10
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)));
        }
Пример #11
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());
        }