Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test builds #109

Merged
merged 8 commits into from
May 16, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Task("TestNetFramework")

NuGetRestore(
string.Format("./tests/{0}/{0}.csproj", frameworkTestProject),
new NuGetRestoreSettings { PackagesDirectory = string.Format("./tests/{0}/packages/", frameworkTestProject) });
new NuGetRestoreSettings { PackagesDirectory = string.Format("./packages/", frameworkTestProject) });

MSBuild(
string.Format("./tests/{0}/{0}.csproj", frameworkTestProject),
Expand Down
20 changes: 8 additions & 12 deletions tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,32 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll</HintPath>
<HintPath>..\..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>.\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text, Version=4.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>.\packages\ServiceStack.Text.4.5.6\lib\net45\ServiceStack.Text.dll</HintPath>
<HintPath>..\..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>.\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
<HintPath>..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>.\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
<HintPath>..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>.\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
<HintPath>..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>.\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
<HintPath>..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="JwtDecoderTest.cs" />
<Compile Include="JwtEncoderTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Serializers\ServiceStackJsonSerializer.cs" />
<Compile Include="Serializers\WebScriptJsonSerializer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
28 changes: 28 additions & 0 deletions tests/JWT.Tests.NETFramework/JwtDecoderTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using FluentAssertions;
using JWT.Serializers;
using JWT.Tests.Common;
using Xunit;

namespace JWT.Tests.NETFramework
{
/// <summary>
/// Sanity tests to make sure the package works from a .NET Framework project.
/// The main tests are in JWT.Tests.Core, which should be cross-platform.
/// </summary>
public class JwtDecoderTest
{
[Fact]
public void Decode_Should_Decode_Token_To_Json_Encoded_String()
{
var serializer = new JsonNetSerializer();
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, null, urlEncoder);

var expectedPayload = serializer.Serialize(TestData.Customer);

var actualPayload = decoder.Decode(TestData.Token, "ABC", verify: false);

actualPayload.Should().Be(expectedPayload);
}
}
}
27 changes: 27 additions & 0 deletions tests/JWT.Tests.NETFramework/JwtEncoderTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using FluentAssertions;
using JWT.Algorithms;
using JWT.Serializers;
using JWT.Tests.Common;
using Xunit;

namespace JWT.Tests.NETFramework
{
/// <summary>
/// Sanity tests to make sure the package works from a .NET Framework project.
/// The main tests are in JWT.Tests.Core, which should be cross-platform.
/// </summary>
public class JwtEncoderTest
{
[Fact]
public void Encode_Should_Encode_To_Token()
{
var serializer = new JsonNetSerializer();
var urlEncoder = new JwtBase64UrlEncoder();
var encoder = new JwtEncoder(new HMACSHA256Algorithm(), serializer, urlEncoder);

var actual = encoder.Encode(TestData.Customer, "ABC");

actual.Should().Be(TestData.Token);
}
}
}

This file was deleted.

This file was deleted.