//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Test.OAuth2 { using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetOpenAuth.OAuth2; using DotNetOpenAuth.OAuth2.Messages; using NUnit.Framework; /// /// Verifies authorization server functionality. /// [TestFixture] public class AuthorizationServerTests : OAuth2TestBase { /// /// Verifies that authorization server responds with an appropriate error response. /// [Test] public void ErrorResponseTest() { var coordinator = new OAuth2Coordinator( AuthorizationServerDescription, AuthorizationServerMock, new UserAgentClient(AuthorizationServerDescription), client => { var request = new AccessTokenAuthorizationCodeRequest(AuthorizationServerDescription) { ClientIdentifier = ClientId, ClientSecret = ClientSecret, AuthorizationCode = "foo" }; var response = client.Channel.Request(request); Assert.That(response.Error, Is.Not.Null.And.Not.Empty); Assert.That(response.Error, Is.EqualTo(Protocol.AccessTokenRequestErrorCodes.InvalidRequest)); }, server => { server.HandleTokenRequest().Respond(); }); coordinator.Run(); } } }