LastAuth tests

This commit is contained in:
Rikki Tooley 2015-01-02 23:14:31 +00:00
parent f267ab1735
commit cc8d6cd2cc
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,34 @@
using IF.Lastfm.Core.Api;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
namespace IF.Lastfm.Core.Tests.Api
{
[TestClass]
public class LastAuthTests
{
private ILastAuth _auth;
[TestInitialize]
public void Initialise()
{
_auth = new LastAuth("user", "pass");
}
[TestMethod]
public void GeneratesCorrectMethodSignature()
{
const string method = "test.method";
var parameters = new Dictionary<string, string>
{
{"test", "value"},
{"test2", "value2"}
};
const string expectedHash = "910231882F8AA6D4BBACB7C5FE5F5CC8";
var actual = _auth.GenerateMethodSignature(method, parameters);
Assert.AreEqual(expectedHash, actual);
}
}
}

View File

@ -84,6 +84,7 @@
<Compile Include="Api\Commands\UserApi\UserGetRecentTracksCommandTests.cs" />
<Compile Include="Api\Commands\UserApi\GetTrackShoutsCommandTests.cs" />
<Compile Include="Api\Helpers\ApiHelperTests.cs" />
<Compile Include="Api\LastAuthTests.cs" />
<Compile Include="Api\MockAlbumApi.cs" />
<Compile Include="MockLastFm.cs" />
<Compile Include="LastFmTests.cs" />