Exemple #1
0
        public async Task <Models.WebChat> UpdateAsync(Models.WebChat webChat, WebChatPatch webChatPatch)
        {
            if (webChat == null)
            {
                return(null);
            }

            webChat.Patch(webChatPatch);
            webChat.SetDefaultValues();

            var documentDbProvider = new DocumentDBProvider();
            var response           = await documentDbProvider.UpdateWebChatAsync(webChat);

            var responseStatusCode = response.StatusCode;

            return(responseStatusCode == HttpStatusCode.OK ? webChat : null);
        }
Exemple #2
0
        public void Setup()
        {
            _webChat      = Substitute.For <Models.WebChat>();
            _webChatPatch = Substitute.For <WebChatPatch>();

            _request = new HttpRequestMessage()
            {
                Content    = new StringContent(string.Empty),
                RequestUri =
                    new Uri($"http://localhost:7071/api/Customers/7E467BDB-213F-407A-B86A-1954053D3C24/" +
                            $"Customers/7E467BDB-213F-407A-B86A-1954053D3C24/" +
                            $"Interactions/1e1a555c-9633-4e12-ab28-09ed60d51cb3/" +
                            $"WebChats/1e1a555c-9633-4e12-ab28-09ed60d51cb3")
            };

            _log                            = Substitute.For <ILogger>();
            _resourceHelper                 = Substitute.For <IResourceHelper>();
            _validate                       = Substitute.For <IValidate>();
            _httpRequestMessageHelper       = Substitute.For <IHttpRequestMessageHelper>();
            _patchWebChatHttpTriggerService = Substitute.For <IPatchWebChatHttpTriggerService>();
            _httpRequestMessageHelper.GetTouchpointId(_request).Returns("0000000001");
            _httpRequestMessageHelper.GetApimURL(_request).Returns("http://localhost:7071/");
        }