public void Clone_Test() { var queue = new QueueConnection("test", string.Empty); var connection = new ConnectionInformation(queue); var clone = connection.Clone(); Assert.Equal(connection.Container, clone.Container); Assert.Equal(connection.QueueName, clone.QueueName); Assert.Equal(connection.ConnectionString, clone.ConnectionString); Assert.Equal(connection.Server, clone.Server); }
private void OnRefresh(ConnectionInformation useConnection) { Debug.Assert(this.CanRefresh(useConnection)); // We're currently only connected to one server. when this will change we will need to refresh all the connected servers ConnectionInformation connectionToRefresh = useConnection ?? this.host.VisualStateManager.GetConnectedServers().FirstOrDefault(); Debug.Assert(connectionToRefresh != null, "Expecting either to be connected to get a connection to connect to"); // Any existing connection will be disposed, so create a copy and use it to connect this.EstablishConnection(connectionToRefresh.Clone()); }
private void OnRefresh(ConnectionInformation useConnection) { Debug.Assert(this.OnRefreshStatus(useConnection)); TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.RefreshCommandCommandCalled); // We're currently only connected to one server. when this will change we will need to refresh all the connected servers ConnectionInformation currentlyConnectedServer = this.host.VisualStateManager.GetConnectedServers().SingleOrDefault(); ConnectionInformation connectionToRefresh = useConnection ?? currentlyConnectedServer; Debug.Assert(connectionToRefresh != null, "Expecting either to be connected to get a connection to connect to"); // Any existing connection will be disposed, so create a copy and use it to connect this.EstablishConnection(connectionToRefresh.Clone()); }