Skip to content

EndpointDispatcher and ClientRuntime #4706

Open
@tapizquent

Description

@tapizquent

Is there any alternative to accessing the ClientRuntime from EndpointDispatcher?

It seems that in .NET 5.0, using System.ServiceModel 4.8.1, EndpointDispatcher class is completely empty, only contains a single empty constructor.

We used to have some tests that would check that an IEndpointBehavior was properly added to the client using WCF.

var myEndpointBehavior = new MyEndpointBehavior();
var serviceEndpoint = new ServiceEndpoint(new ContractDescription("localhost"));
var dispatcher = new EndpointDispatcher(new EndpointAddress("http://localhost"), "", ""); // <--- Error because EndpointDispatcher class is totally empty
var clientRuntime = dispatcher.DispatchRuntime.CallbackClientRuntime; // <---- does not exist

clientRuntime.ClientMessageInspectors.Should().HaveCount(0);
myEndpointBehavior.ApplyClientBehavior(serviceEndpoint, clientRuntime);
clientRuntime.ClientMessageInspectors.Should().HaveCount(1);
clientRuntime.ClientMessageInspectors.First().Should().BeOfType<MyEndpointBehaviorMessageInspector>();

Is there any way to test this same behavior in .NET 5.0?

I have been trying to find a way to access the ClientRuntime but haven't really found anything

Metadata

Metadata

Assignees

Labels

priority 2Stack ranked level of priority. P2triaged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions