public void ServerCommunicationLinkCrud() { var handler = new BasicDelegatingHandler(); using (UndoContext context = UndoContext.Current) { context.Start(); string commLinkName = TestUtilities.GenerateName("csm-sql-commlinkcrud-"); Sql2ScenarioHelper.RunTwoServersTestInEnvironment( handler, "12.0", false, (sqlClient, resGroupName, server1, server2) => { ////////////////////////////////////////////////////////////////////// // Create Test var linkProperties = new ServerCommunicationLinkCreateOrUpdateProperties() { PartnerServer = server2.Name }; var link1 = sqlClient.CommunicationLinks.CreateOrUpdate(resGroupName, server1.Name, commLinkName, new ServerCommunicationLinkCreateOrUpdateParameters() { Location = server1.Location, Properties = linkProperties }); TestUtilities.ValidateOperationResponse(link1, HttpStatusCode.Created); ValidateServerCommunicationLink( link1.ServerCommunicationLink, commLinkName, linkProperties.PartnerServer); ////////////////////////////////////////////////////////////////////// // Get Test. var link2 = sqlClient.CommunicationLinks.Get(resGroupName, server1.Name, commLinkName); TestUtilities.ValidateOperationResponse(link2, HttpStatusCode.OK); ValidateServerCommunicationLink( link2.ServerCommunicationLink, commLinkName, linkProperties.PartnerServer); ////////////////////////////////////////////////////////////////////// // List Test. var links = sqlClient.CommunicationLinks.List(resGroupName, server1.Name); TestUtilities.ValidateOperationResponse(links, HttpStatusCode.OK); Assert.Equal(1, links.ServerCommunicationLinks.Count); ////////////////////////////////////////////////////////////////////// // Delete Test. var resp = sqlClient.CommunicationLinks.Delete(resGroupName, server1.Name, link1.ServerCommunicationLink.Name); TestUtilities.ValidateOperationResponse(resp, HttpStatusCode.OK); }); } }
/// <summary> /// Initializes a new instance of the /// ServerCommunicationLinkCreateOrUpdateParameters class with /// required arguments. /// </summary> public ServerCommunicationLinkCreateOrUpdateParameters(ServerCommunicationLinkCreateOrUpdateProperties properties, string location) : this() { if (properties == null) { throw new ArgumentNullException("properties"); } if (location == null) { throw new ArgumentNullException("location"); } this.Properties = properties; this.Location = location; }