diff --git a/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs b/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs index db0ffc3cd4..ce4b1869e2 100644 --- a/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs +++ b/src/System.ServiceModel.Primitives/ref/System.ServiceModel.Primitives.cs @@ -133,6 +133,7 @@ event System.EventHandler System.ServiceModel.ICommunicationObject.Faulted { add event System.EventHandler System.ServiceModel.ICommunicationObject.Opened { add { } remove { } } event System.EventHandler System.ServiceModel.ICommunicationObject.Opening { add { } remove { } } public void Abort() { } + public void Close() { } protected virtual TChannel CreateChannel() { return default(TChannel); } protected T GetDefaultValueForInitialization() { return default(T); } protected void InvokeAsync(System.ServiceModel.ClientBase.BeginOperationDelegate beginOperationDelegate, object[] inValues, System.ServiceModel.ClientBase.EndOperationDelegate endOperationDelegate, System.Threading.SendOrPostCallback operationCompletedCallback, object userState) { } diff --git a/src/System.ServiceModel.Primitives/tests/ServiceModel/ClientBaseTest.cs b/src/System.ServiceModel.Primitives/tests/ServiceModel/ClientBaseTest.cs new file mode 100644 index 0000000000..bbf31d38d1 --- /dev/null +++ b/src/System.ServiceModel.Primitives/tests/ServiceModel/ClientBaseTest.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +using System; +using System.Collections.Generic; +using System.ServiceModel; +using System.ServiceModel.Description; +using System.ServiceModel.Channels; +using System.Text; +using Infrastructure.Common; +using Xunit; + +public static class ClientBaseTest +{ + [WcfTheory] + public static void ClientBaseCloseMethodClosesCorrectly() + { + // *** SETUP *** \\ + BasicHttpBinding binding = new BasicHttpBinding(); + MyClientBase client = new MyClientBase(binding, new EndpointAddress("http://myendpoint")); + + // *** VALIDATE *** \\ + Assert.Equal(CommunicationState.Created, client.State); + client.Open(); + Assert.Equal(CommunicationState.Opened, client.State); + client.Close(); + Assert.Equal(CommunicationState.Closed, client.State); + } + + public class MyClientBase : ClientBase + { + public MyClientBase(Binding binding, EndpointAddress endpointAddress) + : base(binding, endpointAddress) + { + } + + public ITestService Proxy + { + get { return base.Channel; } + } + } + + [ServiceContract] + public interface ITestService + { + [OperationContract] + string Echo(string message); + } +}