private STPEntity SetupMockSTPRepoResult() { var stpRepoResult = new STPEntity { CCGId = "1234", ProductName = "some app", STPName = "SomeStp", CCGName = "some ccg", ReferralServiceIdWhitelist = "55555|66666|77777", PharmacyServiceIdWhitelist = "9999|0000" }; _mockstpRepo.Setup(r => r.Get(It.IsAny <string>())).Returns(Task.FromResult(stpRepoResult)); return(stpRepoResult); }
private CCGSummaryModel SummaryMap(STPEntity result) { if (result == null) { return(null); } return(new CCGSummaryModel { CCG = result.CCGName, CCGId = result.CCGId, STP = result.STPName, STPId = result.STPId }); }
private CCGModel MapCcgToStp(CCGEntity ccg, STPEntity stp) { if (ccg == null || stp == null) { return(null); } return(new CCGModel { Postcode = ccg.Postcode, STP = stp.STPName, CCG = ccg.CCG, App = ccg.App, DOSSearchDistance = ccg.DOSSearchDistance }); }
private CCGDetailsModel DetailsMap(CCGEntity ccgEntity, STPEntity stpEntity) { if (ccgEntity == null || stpEntity == null) { return(null); } return(new CCGDetailsModel { App = stpEntity.ProductName, CCG = ccgEntity.CCG, Postcode = ccgEntity.Postcode, ReferralServiceIdWhitelist = new ServiceListModel(stpEntity.ReferralServiceIdWhitelist), PharmacyReferralServiceIdWhitelist = new ServiceListModel(stpEntity.PharmacyServiceIdWhitelist), STPName = stpEntity.STPName, DOSSearchDistance = ccgEntity.DOSSearchDistance }); }
public async Task Get_Details_WithExistingPostcode_ReturnsCCGExtendedDetails() { // Arrange var ccgRepoResult = SetupMockCCGRepoResult(); var stpEntity = new STPEntity { ProductName = ccgRepoResult.App, ReferralServiceIdWhitelist = "111111|222222|66666" }; _mockstpRepo.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(stpEntity)); var actualResult = await CCGService().GetDetails(_validPostcode); Assert.AreEqual(ccgRepoResult.Postcode, actualResult.Postcode, TestContext.CurrentContext.Test.Expectation() + " Postcodes didn't match"); Assert.AreEqual(ccgRepoResult.App, actualResult.App, TestContext.CurrentContext.Test.Expectation() + " App didn't match"); Assert.AreEqual(ccgRepoResult.CCG, actualResult.CCG, TestContext.CurrentContext.Test.Expectation() + " CCG didn't match"); Assert.AreEqual(3, actualResult.ReferralServiceIdWhitelist.Count); Assert.IsTrue(actualResult.ReferralServiceIdWhitelist.Contains("66666")); Assert.AreEqual(0, actualResult.PharmacyReferralServiceIdWhitelist.Count); }