public void Given_A_ProfileWithOneVoiceMessage_Should_ReturnTheFirstVoiceMessage() { var profileId = 324784; var profileManager = new Mock<IProfileManager>(); var apiRequest = new Mock<IApiRequest>(); var refUnitedAcctManager = new RefugeesUnitedAccountManager(apiRequest.Object); var routeProvider = new Mock<IIVRRouteProvider>(); profileManager.Setup(m => m.GetRecordings(profileId)).Returns(new List<Common.Entities.Recording>() { new Common.Entities.Recording() { FromProfileId = 111, ToProfileId = profileId, Url = "url" } }); //this is what we are testing! var logic = new IVRMainLogic(profileManager.Object, refUnitedAcctManager, routeProvider.Object); var result = logic.PlayRecordedVoiceMessage(new VoiceRequest(), profileId, 0); Assert.AreEqual("<Response>\r\n <Say>Playing message 1</Say>\r\n <Play>url</Play>\r\n <Gather numDigits=\"1\" action=\"/IVRMain/PlayRecordedMessage_Response?profileId=324784&recordingIdx=0&fromProfileId=111\">\r\n <Say>Press one to repeat this message</Say>\r\n <Say>Press two to delete this message</Say>\r\n <Say>Press three to reply to this message</Say>\r\n <Say>Press four to go to the next message</Say>\r\n </Gather>\r\n</Response>" , result.ToString()); }
public void Given_A_ProfileWithNoVoiceMessages_Should_ReturnNoVoiceMessagesPendingMessage() { var profileId = 324784; var profileManager = new Mock<IProfileManager>(); var apiRequest = new Mock<IApiRequest>(); var refUnitedAcctManager = new RefugeesUnitedAccountManager(apiRequest.Object); var routeProvider = new Mock<IIVRRouteProvider>(); routeProvider.Setup(m => m.GetUrlMethod(RefUnitedIVRPlatform.Common.IVRRoutes.PLAY_MAIN_MENU)).Returns("/IVRMain/MainMenu"); profileManager.Setup(m => m.GetRecordings(profileId)).Returns(new List<Common.Entities.Recording>()); //this is what we are testing! var logic = new IVRMainLogic(profileManager.Object, refUnitedAcctManager, routeProvider.Object); var result = logic.PlayRecordedVoiceMessage(new VoiceRequest(), profileId, null); Assert.AreEqual("<Response>\r\n <Say>You have no voice messages</Say>\r\n <Redirect>/IVRMain/MainMenu</Redirect>\r\n</Response>", result.ToString()); }