Skip to content

Commit

Permalink
Unit test for IssuedSecurityTokenParameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
imcarolwang committed Sep 27, 2019
1 parent f296b23 commit 23c4f1c
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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.IdentityModel.Tokens;
using System.ServiceModel;
using System.ServiceModel.Security.Tokens;
using Infrastructure.Common;
using Xunit;

public static class IssuedSecurityTokenParametersTest
{
[WcfFact]
public static void Ctor_Default()
{
IssuedSecurityTokenParameters tokenParameters = new IssuedSecurityTokenParameters();
Assert.NotNull(tokenParameters);
}

[WcfFact]
public static void Properties_Settable()
{
var edpa = new EndpointAddress("https://localhost");
var binding = new BasicHttpsBinding();
string tokenType = "http://schemas.microsoft.com/ws/2006/05/identitymodel/securitytokenrequirement/TokenType";

IssuedSecurityTokenParameters tokenParameters = new IssuedSecurityTokenParameters()
{
DefaultMessageSecurityVersion = MessageSecurityVersion.Default,
IssuerAddress = edpa,
IssuerBinding = binding,
KeyType = SecurityKeyType.AsymmetricKey,
TokenType = tokenType
};

Assert.Equal(MessageSecurityVersion.Default, tokenParameters.DefaultMessageSecurityVersion);
Assert.Equal(edpa, tokenParameters.IssuerAddress);
Assert.Equal(binding, tokenParameters.IssuerBinding);
Assert.Equal(SecurityKeyType.AsymmetricKey, tokenParameters.KeyType);
Assert.Equal(tokenType, tokenParameters.TokenType);
}
}

0 comments on commit 23c4f1c

Please sign in to comment.