private static void AssertSourceControl(SourceControl expectedSourceControl, SourceControl actualSourceControl)
 {
     Assert.Equal(expectedSourceControl.Name, actualSourceControl.Name);
     Assert.Equal(expectedSourceControl.Properties.Token, actualSourceControl.Properties.Token);
     Assert.Equal(expectedSourceControl.Properties.TokenSecret, actualSourceControl.Properties.TokenSecret);
 }
        public void LinkAndUnlinkSourceControlToWebsiteShouldSucceed()
        {
            RunWebsiteTestScenario(
                (webSiteName, resourceGroupName, whpName, locationName, webSitesClient, resourcesClient) =>
                {
                    var gitHubSourceControl = new SourceControl()
                    {
                        Name = "GitHub",
                        Properties = new SourceControlProperties()
                        {
                            Token = "36c7290f81fda5877d52d2fc3fbc7c31acd25051"
                        }
                    };

                    webSitesClient.SourceControls.Update(gitHubSourceControl.Name, new SourceControlUpdateParameters()
                    {
                        Properties = gitHubSourceControl.Properties
                    });

                    SiteSourceControlUpdateResponse siteSourceControlUpdateResponse =
                        webSitesClient.WebSites.UpdateSiteSourceControl(
                            resourceGroupName,
                            webSiteName,
                            null,
                            new SiteSourceControlUpdateParameters(
                                new SiteSourceControlProperties("https://github.com/amitaptest/HelloKudu")));

                    Assert.Equal(HttpStatusCode.OK, siteSourceControlUpdateResponse.StatusCode);
                    Assert.Equal("https://github.com/amitaptest/HelloKudu", siteSourceControlUpdateResponse.SiteSourceControl.Properties.RepoUrl);

                    AzureOperationResponse operationResponse =
                        webSitesClient.WebSites.DeleteSiteSourceControl(
                            resourceGroupName,
                            webSiteName,
                            null,
                            "https://github.com/amitaptest/HelloKudu");

                    Assert.Equal(HttpStatusCode.OK, operationResponse.StatusCode);
                });
        }