Exemplo n.º 1
0
        public async Task UpdateExtensionChangeDestinationWithAzureFunction()
        {
            await WithUpdateableExtension(client, async extension =>
            {
                var newDestination = new HttpDestination
                {
                    Url            = "http://www.new-destination.com/",
                    Authentication = new AzureFunctionsAuthentication {
                        Key = "default-Key"
                    }
                };
                var updateActions           = new List <UpdateAction <Extension> >();
                var changeDestinationAction = new ChangeDestinationUpdateAction
                {
                    Destination = newDestination
                };
                updateActions.Add(changeDestinationAction);

                var updatedExtension = await client
                                       .ExecuteAsync(new UpdateByIdCommand <Extension>(extension, updateActions));

                var updatedDestination = updatedExtension.Destination as HttpDestination;
                Assert.NotNull(updatedDestination);
                Assert.Equal(newDestination.Url, updatedDestination.Url);
                var updatedAuthentication = updatedDestination.Authentication as AzureFunctionsAuthentication;
                Assert.NotNull(updatedAuthentication);
                return(updatedExtension);
            });
        }
Exemplo n.º 2
0
        public async Task UpdateExtensionChangeDestination()
        {
            await WithUpdateableExtension(client, async extension =>
            {
                var headerValue    = "newhZGRpbjpvcGVuIHNlc2FtZQ==";
                var newDestination = new HttpDestination
                {
                    Url            = "http://www.new-destination.com/",
                    Authentication = new AuthorizationHeader
                    {
                        HeaderValue = headerValue
                    }
                };
                var updateActions           = new List <UpdateAction <Extension> >();
                var changeDestinationAction = new ChangeDestinationUpdateAction
                {
                    Destination = newDestination
                };
                updateActions.Add(changeDestinationAction);

                var updatedExtension = await client
                                       .ExecuteAsync(new UpdateByIdCommand <Extension>(extension, updateActions));

                var updatedDestination = updatedExtension.Destination as HttpDestination;
                Assert.NotNull(updatedDestination);
                Assert.Equal(newDestination.Url, updatedDestination.Url);
                var updatedAuthentication = updatedDestination.Authentication as AuthorizationHeader;
                Assert.NotNull(updatedAuthentication);
                return(updatedExtension);
            });
        }