public async Task SuccessfullySendsUrl() { using (var testClient = new HttpClient(new SuccessfullySendUrl()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new SendUrlWorkflow(testClient); var response = await workflow.Process(connectEvent, context); Assert.True(response["LambdaResult"].Type == JTokenType.Boolean); Assert.True((bool)response["LambdaResult"]); } }
public async Task FailsIfClientUrlNotSpecified() { var badConnectEvent = JObject.Parse(@"{ ""Details"": { ""ContactData"": { ""Attributes"": { ""SessionUrl"": ""session/10001"", ""PropertiesUrl"": ""session/10001/properties"", ""ControlMessageUrl"": ""session/10001/controlmessage"", ""SessionStatus"": ""connected"" }, ""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"": ""SendUrl"" } }, ""Name"": ""ContactFlowEvent"" }"); using (var testClient = new HttpClient(new SuccessfullySendUrl()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new SendUrlWorkflow(testClient); var response = await workflow.Process(badConnectEvent, context); Assert.True(response["LambdaResult"].Type == JTokenType.Boolean); Assert.False((bool)response["LambdaResult"]); Assert.True(response["FailureReason"].Type == JTokenType.String); } }
public async Task FailsToSendUrl() { using (var testClient = new HttpClient(new FailToSendUrl()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new SendUrlWorkflow(testClient); var response = await workflow.Process(connectEvent, context); Assert.True(response["LambdaResult"].Type == JTokenType.Boolean); Assert.False((bool)response["LambdaResult"]); Assert.True(response["StatusCode"].Type == JTokenType.Integer); Assert.True(HttpStatusCode.NotFound == (HttpStatusCode)(int)response["StatusCode"]); Assert.Equal("disconnected", (string)response["SessionStatus"]); Assert.True(response["FailureReason"].Type == JTokenType.String); } }