public void GetItemUrl_ItemId_UrlReceived() { var urlHelper = Substitute.For <UrlHelper>(); _routeNameProvider = Substitute.For <IRouteNameProvider>(); _itemUrlGenerator = new UrlGenerator(urlHelper, _routeNameProvider); _routeNameProvider.GetRouteName().Returns(RouteConfig.DefaultApi); urlHelper.Route(RouteConfig.DefaultApi, Arg.Is <object>(o => ContainsCorrectId(o))).Returns($"api/{FakeId}/v2.1/itemlist"); var id = FakeId; var requestedUrl = $"api/{FakeId}/v2.1/itemlist"; var receivedUrl = _itemUrlGenerator.GetItemUrl(id); Assert.That(receivedUrl, Is.EqualTo(requestedUrl)); }
public UrlGenerator(UrlHelper urlHelper, IRouteNameProvider routeNameProvider) { _urlHelper = urlHelper; _routeNameProvider = routeNameProvider; }