public void Setup() { _interaction = new Models.Interaction(); _request = null; _log = new Mock <ILogger>(); _resourceHelper = new Mock <IResourceHelper>(); _httpRequestMessageHelper = new Mock <IHttpRequestHelper>(); _validate = new Mock <IValidate>(); _postInteractionHttpTriggerService = new Mock <IPostInteractionHttpTriggerService>(); _httpResponseMessageHelper = new HttpResponseMessageHelper(); _jsonHelper = new JsonHelper(); _function = new PostInteractionHttpTrigger.Function.PostInteractionHttpTrigger(_resourceHelper.Object, _httpRequestMessageHelper.Object, _postInteractionHttpTriggerService.Object, _validate.Object, _httpResponseMessageHelper, _jsonHelper); }
public void Setup() { _interaction = new Models.Interaction(); _request = null; _log = new Mock <ILogger>(); _resourceHelper = new Mock <IResourceHelper>(); _httpRequestMessageHelper = new Mock <IHttpRequestHelper>(); _getInteractionByIdHttpTriggerService = new Mock <IGetInteractionByIdHttpTriggerService>(); _httpRequestMessageHelper = new Mock <IHttpRequestHelper>(); _httpResponseMessageHelper = new HttpResponseMessageHelper(); _jsonHelper = new JsonHelper(); function = new GetInteractionByIdHttpTrigger.Function.GetInteractionByIdHttpTrigger(_resourceHelper.Object, _httpRequestMessageHelper.Object, _getInteractionByIdHttpTriggerService.Object, _httpResponseMessageHelper, _jsonHelper); }
public async Task <Models.Interaction> CreateAsync(Models.Interaction interaction) { if (interaction == null) { return(null); } interaction.SetDefaultValues(); var documentDbProvider = new DocumentDBProvider(); var response = await documentDbProvider.CreateInteractionAsync(interaction); return(response.StatusCode == HttpStatusCode.Created ? (dynamic)response.Resource : null); }
public async Task <ResourceResponse <Document> > UpdateInteractionAsync(Models.Interaction interaction) { var documentUri = DocumentDBHelper.CreateDocumentUri(interaction.InteractionId.GetValueOrDefault()); var client = DocumentDBClient.CreateDocumentClient(); if (client == null) { return(null); } var response = await client.ReplaceDocumentAsync(documentUri, interaction); return(response); }
public async Task <ResourceResponse <Document> > CreateInteractionAsync(Models.Interaction interaction) { var collectionUri = DocumentDBHelper.CreateDocumentCollectionUri(); var client = DocumentDBClient.CreateDocumentClient(); if (client == null) { return(null); } var response = await client.CreateDocumentAsync(collectionUri, interaction); return(response); }
public async Task <Models.Interaction> UpdateAsync(Models.Interaction interaction, InteractionPatch interactionPatch) { if (interaction == null) { return(null); } interactionPatch.SetDefaultValues(); interaction.Patch(interactionPatch); var documentDbProvider = new DocumentDBProvider(); var response = await documentDbProvider.UpdateInteractionAsync(interaction); var responseStatusCode = response.StatusCode; return(responseStatusCode == HttpStatusCode.OK ? interaction : null); }
public static async Task SendPatchMessageAsync(Models.Interaction interaction, Guid customerId, string reqUrl) { var queueClient = new QueueClient(ServiceBusConnectionString, QueueName); var messageModel = new MessageModel { TitleMessage = "Interaction record modification for {" + customerId + "} at " + DateTime.UtcNow, CustomerGuid = customerId, LastModifiedDate = interaction.LastModifiedDate, URL = reqUrl, IsNewCustomer = false, TouchpointId = interaction.LastModifiedTouchpointId }; var msg = new Message(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(messageModel))) { ContentType = "application/json", MessageId = customerId + " " + DateTime.UtcNow }; await queueClient.SendAsync(msg); }
public async Task SendToServiceBusQueueAsync(Models.Interaction interaction, string reqUrl) { await ServiceBusClient.SendPostMessageAsync(interaction, reqUrl); }
public async Task SendToServiceBusQueueAsync(Models.Interaction interaction, Guid customerId, string reqUrl) { await ServiceBusClient.SendPatchMessageAsync(interaction, customerId, reqUrl); }