forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hacky test to show timeout issue
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...stem.Private.ServiceModel/tests/Scenarios/Binding/Tcp/NetTcpBindingTests_DelayedMethod.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using Infrastructure.Common; | ||
using System.ServiceModel; | ||
using Xunit; | ||
|
||
public partial class Binding_Tcp_NetTcpBindingTests : ConditionalWcfTest | ||
{ | ||
// Simple echo of a string using NetTcpBinding on both client and server with all default settings. | ||
// Default settings are: | ||
// - SecurityMode = Transport | ||
// - ClientCredentialType = Windows | ||
[WcfFact] | ||
[Condition(nameof(Windows_Authentication_Available))] | ||
[OuterLoop] | ||
public static void DefaultSettings_Echo_DelayedMethod() | ||
{ | ||
string testString = "Hello"; | ||
ChannelFactory<IWcfService> factory = null; | ||
IWcfService serviceProxy = null; | ||
|
||
try | ||
{ | ||
// *** SETUP *** \\ | ||
NetTcpBinding binding = new NetTcpBinding(); | ||
binding.OpenTimeout = TimeSpan.FromMilliseconds(500); | ||
factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_DefaultBinding_Address)); | ||
serviceProxy = factory.CreateChannel(); | ||
((ICommunicationObject)serviceProxy).Open(); | ||
System.Threading.Thread.Sleep(1000); | ||
// *** EXECUTE *** \\ | ||
string result = serviceProxy.Echo(testString); | ||
|
||
// *** VALIDATE *** \\ | ||
Assert.Equal(testString, result); | ||
|
||
// *** CLEANUP *** \\ | ||
((ICommunicationObject)serviceProxy).Close(); | ||
factory.Close(); | ||
} | ||
finally | ||
{ | ||
// *** ENSURE CLEANUP *** \\ | ||
ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory); | ||
} | ||
} | ||
} |