forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec33be5
commit 0dc86cf
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...stem.ServiceModel.NetTcp/tests/Channels/SecurityModeTransportWithMessageCredentialTest.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,32 @@ | ||
// 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.ServiceModel.Channels; | ||
using System.ServiceModel.Security; | ||
using Infrastructure.Common; | ||
using Xunit; | ||
|
||
namespace System.ServiceModel.NetTcp.Tests | ||
{ | ||
public static class SecurityModeTransportWithMessageCredentialTest | ||
{ | ||
[WcfFact] | ||
public static void Init_TransportWithMessageCredentialSecurityMode() | ||
{ | ||
NetTcpBinding binding = new NetTcpBinding(SecurityMode.TransportWithMessageCredential); | ||
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; | ||
BindingElementCollection bindingElements = binding.CreateBindingElements(); | ||
SecurityBindingElement secutityBindingElement = bindingElements.Find<SecurityBindingElement>(); | ||
|
||
Assert.StrictEqual(binding.Security.Mode, SecurityMode.TransportWithMessageCredential); | ||
Assert.True(secutityBindingElement != null, "SecurityBindingElement should not be null."); | ||
|
||
Assert.True(binding.Security.Message.AlgorithmSuite == SecurityAlgorithmSuite.Default, "AlgorithmSuite should be Default."); | ||
Assert.True(binding.Security.Message.ClientCredentialType == MessageCredentialType.UserName, "ClientCredentialType should be UserName."); | ||
|
||
binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; | ||
Assert.True(binding.Security.Message.ClientCredentialType == MessageCredentialType.Certificate, "ClientCredentialType should be Certifiacte."); | ||
} | ||
} | ||
} |
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