Skip to content

Commit

Permalink
Merge pull request #1 from mrstebo/hotfix/default-services
Browse files Browse the repository at this point in the history
Hotfix/default services
  • Loading branch information
mrstebo authored Sep 28, 2016
2 parents d33e2cb + 2f42995 commit 28b85b6
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Nancy.OAuth2.Tests/Nancy.OAuth2.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<Compile Include="Modules\AuthorizeModuleTests.cs" />
<Compile Include="Modules\TokenModuleTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\DefaultAuthorizationEndpointServiceTests.cs" />
<Compile Include="Services\DefaultTokenEndpointServiceTests.cs" />
<Compile Include="StubFactory.cs" />
<Compile Include="TestRootPathProvider.cs" />
</ItemGroup>
Expand Down Expand Up @@ -110,4 +112,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using Nancy.OAuth2.Models;
using Nancy.OAuth2.Services;
using NUnit.Framework;

namespace Nancy.OAuth2.Tests.Services
{
[TestFixture]
[Parallelizable]
public class DefaultAuthorizationEndpointServiceTests
{
private IAuthorizationEndpointService _service;

[SetUp]
public void SetUp()
{
_service = new DefaultAuthorizationEndpointService();
}

[Test]
public void GenerateAuthorizationToken_ShouldThrow_NotImplementedException()
{
var request = new AuthorizationRequest();
var context = new NancyContext();

Assert.Throws<NotImplementedException>(() => _service.GenerateAuthorizationToken(request, context));
}

[Test]
public void ValidateRequest_ShouldThrow_NotImplementedException()
{
var request = new AuthorizationRequest();
var context = new NancyContext();

Assert.Throws<NotImplementedException>(() => _service.ValidateRequest(request, context));
}

[Test]
public void GetAuthorizationView_ShouldThrow_NotImplementedException()
{
var request = new AuthorizationRequest();
var context = new NancyContext();

Assert.Throws<NotImplementedException>(() => _service.GetAuthorizationView(request, context));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using Nancy.OAuth2.Models;
using Nancy.OAuth2.Services;
using NUnit.Framework;

namespace Nancy.OAuth2.Tests.Services
{
[TestFixture]
[Parallelizable]
public class DefaultTokenEndpointServiceTests
{
private ITokenEndpointService _service;

[SetUp]
public void SetUp()
{
_service = new DefaultTokenEndpointService();
}

[Test]
public void ValidateRequest_ShouldThrow_NotImplementedException()
{
var request = new TokenRequest();
var context = new NancyContext();

Assert.Throws<NotImplementedException>(() => _service.ValidateRequest(request, context));
}

[Test]
public void CreateTokenResponse_ShouldThrow_NotImplementedException()
{
var request = new TokenRequest();
var context = new NancyContext();

Assert.Throws<NotImplementedException>(() => _service.CreateTokenResponse(request, context));
}
}
}
4 changes: 3 additions & 1 deletion src/Nancy.OAuth2/Nancy.OAuth2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QueryStringExtensions.cs" />
<Compile Include="ResponseFormatterExtensions.cs" />
<Compile Include="Services\DefaultAuthorizationEndpointService.cs" />
<Compile Include="Services\DefaultTokenEndpointService.cs" />
<Compile Include="Services\IAuthorizationEndpointService.cs" />
<Compile Include="Services\ITokenEndpointService.cs" />
</ItemGroup>
Expand All @@ -78,4 +80,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
23 changes: 23 additions & 0 deletions src/Nancy.OAuth2/Services/DefaultAuthorizationEndpointService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using Nancy.OAuth2.Models;

namespace Nancy.OAuth2.Services
{
public class DefaultAuthorizationEndpointService : IAuthorizationEndpointService
{
public string GenerateAuthorizationToken(AuthorizationRequest request, NancyContext context)
{
throw new NotImplementedException();
}

public OAuthValidationResult ValidateRequest(AuthorizationRequest request, NancyContext context)
{
throw new NotImplementedException();
}

public Tuple<string, object> GetAuthorizationView(AuthorizationRequest request, NancyContext context)
{
throw new NotImplementedException();
}
}
}
17 changes: 17 additions & 0 deletions src/Nancy.OAuth2/Services/DefaultTokenEndpointService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Nancy.OAuth2.Models;

namespace Nancy.OAuth2.Services
{
public class DefaultTokenEndpointService : ITokenEndpointService
{
public OAuthValidationResult ValidateRequest(TokenRequest request, NancyContext context)
{
throw new System.NotImplementedException();
}

public TokenResponse CreateTokenResponse(TokenRequest request, NancyContext context)
{
throw new System.NotImplementedException();
}
}
}

0 comments on commit 28b85b6

Please sign in to comment.