2020-05-01 19:05:28 +01:00
|
|
|
using System;
|
2022-11-27 12:29:35 +00:00
|
|
|
using System.Collections.Generic;
|
2020-05-01 19:05:28 +01:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web.Tests
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class URIParameterFormatProviderTest
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void Format_NormalParameters()
|
|
|
|
{
|
|
|
|
var expected = "/users/wizzler";
|
|
|
|
|
|
|
|
var user = "wizzler";
|
|
|
|
var formatter = new URIParameterFormatProvider();
|
2020-05-02 12:04:26 +01:00
|
|
|
string func(FormattableString str) => str.ToString(formatter);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
|
|
|
Assert.AreEqual(expected, func($"/users/{user}"));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Format_EscapedParameters()
|
|
|
|
{
|
|
|
|
var expected = "/users/++wizzler";
|
|
|
|
|
|
|
|
var user = " wizzler";
|
|
|
|
var formatter = new URIParameterFormatProvider();
|
2020-05-02 12:04:26 +01:00
|
|
|
string func(FormattableString str) => str.ToString(formatter);
|
2020-05-01 19:05:28 +01:00
|
|
|
|
|
|
|
Assert.AreEqual(expected, func($"/users/{user}"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|