Spotify.NET/SpotifyAPI.Web.Tests/UtilTests/URIParameterFormatProviderTest.cs

34 lines
797 B
C#
Raw Normal View History

2020-05-01 19:05:28 +01:00
using System;
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();
string func(FormattableString str) => str.ToString(formatter);
2020-05-01 19:05:28 +01:00
Assert.That(expected, Is.EqualTo(func($"/users/{user}")));
2020-05-01 19:05:28 +01:00
}
[Test]
public void Format_EscapedParameters()
{
var expected = "/users/++wizzler";
var user = " wizzler";
var formatter = new URIParameterFormatProvider();
string func(FormattableString str) => str.ToString(formatter);
2020-05-01 19:05:28 +01:00
Assert.That(expected, Is.EqualTo(func($"/users/{user}")));
2020-05-01 19:05:28 +01:00
}
}
}