btcpayserver/BTCPayServer.Tests/Mocks/UrlHelperMock.cs

44 lines
1,010 B
C#
Raw Normal View History

2017-09-13 15:47:34 +09:00
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Mvc.Routing;
namespace BTCPayServer.Tests.Mocks
{
public class UrlHelperMock : IUrlHelper
{
Uri _BaseUrl;
public UrlHelperMock(Uri baseUrl)
{
_BaseUrl = baseUrl;
}
public ActionContext ActionContext => throw new NotImplementedException();
2017-09-13 15:47:34 +09:00
public string Action(UrlActionContext actionContext)
{
return $"{_BaseUrl}mock";
}
2017-09-13 15:47:34 +09:00
public string Content(string contentPath)
{
return $"{_BaseUrl}{contentPath}";
}
2017-09-13 15:47:34 +09:00
public bool IsLocalUrl(string url)
{
return false;
}
2017-09-13 15:47:34 +09:00
public string Link(string routeName, object values)
{
return _BaseUrl.AbsoluteUri;
}
2017-09-13 15:47:34 +09:00
public string RouteUrl(UrlRouteContext routeContext)
{
return _BaseUrl.AbsoluteUri;
}
}
2017-09-13 15:47:34 +09:00
}