/// <summary> /// Get InternalEmailAddressType based on CancellationReasoCode /// </summary> /// <returns></returns> private InternalEmailAddressType GetInternalEmailAddressType(CancellationReasonEnum cancellationReasonEnum) { switch (cancellationReasonEnum) { case CancellationReasonEnum.Cancelled : case CancellationReasonEnum.AdminCancelled: return InternalEmailAddressType.OTACancel; case CancellationReasonEnum.CardDeclined: return InternalEmailAddressType.CCDecline; default: // if not one of the above reasons, go to support return InternalEmailAddressType.Support; } }
/// <summary> /// Get Email subject text based on cancellation reason /// </summary> /// <param name="cancellationReasonEnum"></param> /// <returns></returns> private string GetCancellationRequestReasonSubjectText(CancellationReasonEnum cancellationReasonEnum) { switch (cancellationReasonEnum) { case CancellationReasonEnum.Cancelled: case CancellationReasonEnum.AdminCancelled: return EmailTexts.CancellationRequest; case CancellationReasonEnum.CardDeclined: return EmailTexts.CardDeclined; default: return string.Empty; } }
public void TestMobileCodeConversion(string mobileCode, CancellationReasonEnum expectedReason, bool throwsException) { // Arrange // Act try { CancellationReasonEnum reasonResult = pmsMobile.GetCancellationReasonFromMobileCancellationReason(mobileCode); // Assert Assert.AreEqual(expectedReason, reasonResult, "Cancellation reason returned was not as expected"); Assert.AreEqual(false, throwsException, "Did not throw exception when expected to"); } catch (Exception ex) { // Assert Assert.IsTrue(throwsException, string.Format("Threw exception when it shouldn't have: {0}", ex.Message)); } }