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"); }
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); }
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); }
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()); }
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"); }
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); }
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"); }
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"); }
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()); }
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))); }
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()); }