public async Task SuccessfullyTransferSession() { using (var testClient = new HttpClient(new SuccessfullyTransferSession()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new TransferSessionWorkflow(testClient); var response = await workflow.Process(_connectEvent, _context); Assert.Equal(JTokenType.Boolean, response["LambdaResult"].Type); Assert.True((bool)response["LambdaResult"]); } }
public async Task FailsIfAccountIdNotSpecified() { var badConnectEvent = JObject.Parse(@"{ ""Details"": { ""ContactData"": { ""Attributes"": { ""SessionUrl"": ""session/10001"", ""PropertiesUrl"": ""session/10001/properties"", ""ControlMessageUrl"": ""session/10001/controlmessage"", }, ""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"": ""TransferSession"" } }, ""Name"": ""ContactFlowEvent"" }"); using (var testClient = new HttpClient(new SuccessfullyTransferSession()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new TransferSessionWorkflow(testClient); var response = await workflow.Process(badConnectEvent, _context); Assert.Equal(JTokenType.Boolean, response["LambdaResult"].Type); Assert.False((bool)response["LambdaResult"]); Assert.False(response.TryGetValue("StatusCode", out var value)); Assert.Equal(JTokenType.String, response["FailureReason"].Type); } }
public async Task FailsToTransferSession() { using (var testClient = new HttpClient(new FailToTransferSession()) { BaseAddress = new Uri("https://cvnet2.radishsystems.com/ivr/api/") }) { var workflow = new TransferSessionWorkflow(testClient); var response = await workflow.Process(_connectEvent, _context); Assert.Equal(JTokenType.Boolean, response["LambdaResult"].Type); Assert.False((bool)response["LambdaResult"]); Assert.Equal(JTokenType.Integer, response["StatusCode"].Type); Assert.Equal(HttpStatusCode.NotFound, (HttpStatusCode)(int)response["StatusCode"]); Assert.Equal("disconnected", (string)response["SessionStatus"]); Assert.Equal(JTokenType.String, response["FailureReason"].Type); } }