public void Test_GetMedicationProfile_Service_NotFound() { var caseNumber = "Any_CaseNumber"; var httpStatusCode = HttpStatusCode.NotFound; var localParser = new RestParserSvc(restUri + @"invalidurl/", "CLIENT_SECRET", "CLIENT_ID", "PATHOSPCODE"); var actualException = Assert.ThrowsException <AMException>(() => localParser.GetMedicationProfile(caseNumber)); Assert.AreEqual(actualException.HttpStatusCode, httpStatusCode); }
public void Test_GetMedicationProfile_Service_Unavailable() { var caseNumber = "Any_CaseNumber"; var httpStatusCode = HttpStatusCode.ServiceUnavailable; var localParser = new RestParserSvc("http://localhost:3181/pms-asa/invalidurl/", "CLIENT_SECRET", "CLIENT_ID", "PATHOSPCODE"); var actualException = Assert.ThrowsException <AMException>(() => localParser.GetMedicationProfile(caseNumber)); Assert.AreEqual(actualException.HttpStatusCode, httpStatusCode); }
public void Test_GetMedicationProfile_Invalid_PATHOSPCODE() { var caseNumber = "Any_CaseNumber"; var localParser = new RestParserSvc(restUri, "CLIENT_SECRET", "CLIENT_ID", "INVALID_PATHOSPCODE"); var actualProfile = localParser.GetMedicationProfile(caseNumber); Assert.IsNotNull(actualProfile); Assert.IsNull(actualProfile.MedProfileId); Assert.IsNull(actualProfile.CaseNum); Assert.IsNull(actualProfile.MedProfileMoItems); }
public void Test_GetMedicationProfile_Invalid_Client_Secret() { var caseNumber = "INVALID_CLIENT_SECRET"; var errorMessage = "Unauthorized"; var httpStatusCode = HttpStatusCode.Unauthorized; var localParser = new RestParserSvc(restUri, "INVALID_CLIENT_SECRET", "CLIENT_ID", "PATHOSPCODE"); var actualException = Assert.ThrowsException <AMException>(() => localParser.GetMedicationProfile(caseNumber)); Assert.AreEqual(actualException.HttpStatusCode, httpStatusCode); Assert.AreEqual(actualException.Message, errorMessage); }