mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-25 15:36:26 +00:00
55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using Newtonsoft.Json;
|
||
|
using NUnit.Framework;
|
||
|
|
||
|
namespace SpotifyAPI.Web.Tests
|
||
|
{
|
||
|
[TestFixture]
|
||
|
public class RequestParamsTest
|
||
|
{
|
||
|
[Test]
|
||
|
public void CacheDoesNotInterfereQuery()
|
||
|
{
|
||
|
var first = new FirstRequestModel { First = true };
|
||
|
var firstParams = first.BuildQueryParams();
|
||
|
|
||
|
var second = new SecondRequestModel { Second = false };
|
||
|
var secondParams = second.BuildQueryParams();
|
||
|
|
||
|
Assert.AreEqual(1, firstParams.Keys.Count);
|
||
|
Assert.AreEqual("true", firstParams["first"]);
|
||
|
|
||
|
Assert.AreEqual(1, secondParams.Keys.Count);
|
||
|
Assert.AreEqual("false", secondParams["second"]);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void CacheDoesNotInterfereBody()
|
||
|
{
|
||
|
var first = new FirstRequestModel { First = true };
|
||
|
var firstParams = first.BuildBodyParams();
|
||
|
|
||
|
var second = new SecondRequestModel { Second = false };
|
||
|
var secondParams = second.BuildBodyParams();
|
||
|
|
||
|
Assert.AreEqual("{\"first\":true}", firstParams.ToString(Formatting.None));
|
||
|
Assert.AreEqual("{\"second\":false}", secondParams.ToString(Formatting.None));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public class FirstRequestModel : RequestParams
|
||
|
{
|
||
|
[BodyParam("first")]
|
||
|
[QueryParam("first")]
|
||
|
public bool? First { get; set; }
|
||
|
}
|
||
|
|
||
|
public class SecondRequestModel : RequestParams
|
||
|
{
|
||
|
[BodyParam("second")]
|
||
|
[QueryParam("second")]
|
||
|
public bool? Second { get; set; }
|
||
|
}
|
||
|
}
|