public async Task FailsToGetSession() { using (var testClient = new HttpClient(new FailToGetSession()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new GetSessionWorkflow(testClient); var response = await workflow.Process(connectEvent, context); Assert.Equal(JTokenType.Boolean, response["LambdaResult"].Type); Assert.True((bool)response["LambdaResult"]); Assert.Equal("disconnected", (string)response["SessionStatus"]); } }
public async Task FailsIfSessionUrlNotSpecified() { var badConnectEvent = JObject.Parse(@"{ ""Details"": { ""ContactData"": { ""Attributes"": {}, ""Channel"": ""VOICE"", ""ContactId"": ""ASDAcxcasDFSSDFs"", ""CustomerEndpoint"": { ""Address"": ""+17202950840"", ""Type"": ""TELEPHONE_NUMBER"" }, ""InitialContactId"": """", ""InitiationMethod"": ""INBOUND"", ""InstanceARN"": ""arn:aws:connect:us-east-1:396263001796:instance/1aad3ca7-ea11-4d98-bf4f-30a2644dd195"", ""PreviousContactId"": """", ""Queue"": null, ""SystemEndpoint"": { ""Address"": ""+17025346630"", ""Type"": ""TELEPHONE_NUMBER"" } }, ""Parameters"": { ""RequestName"": ""GetSession"", } }, ""Name"": ""ContactFlowEvent"" }"); using (var testClient = new HttpClient(new SuccessfullyGetSession()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new GetSessionWorkflow(testClient); var response = await workflow.Process(badConnectEvent, context); Assert.Equal(JTokenType.Boolean, response["LambdaResult"].Type); Assert.False((bool)response["LambdaResult"]); Assert.Equal(JTokenType.String, response["FailureReason"].Type); } }