public void GetLinkAsyncReturnsCorrectUriForExpressionOfFuncWithComplexParameter( [Frozen]HttpRequestMessage request, RouteLinker forComparison, UrlHelper sut, SomeModel someModel) { request.AddDefaultRoute(); var expected = forComparison.GetUriAsync<ModelAsyncController, object>(a => a.Get(someModel)).Result; var actual = sut.GetLinkAsync<ModelAsyncController, object>(a => a.Get(someModel)).Result; Assert.Equal(expected, actual); }
public void GetUriFromModelControllerReturnsCorrectResponse( [Frozen]HttpRequestMessage request, [Frozen]Mock<IRouteValuesQuery> queryStub, [Frozen(As = typeof(IRouteDispatcher))]DefaultRouteDispatcher dummy, [Greedy]RouteLinker sut, SomeModel model) { request.AddDefaultRoute(); queryStub.SetReturnsDefault<IDictionary<string, object>>( new Dictionary<string, object> { { "number", model.Number.ToString() }, { "text", model.Text } }); var actual = sut.GetUri<ModelController>(c => c.Get(model)); var baseUri = request.RequestUri.GetLeftPart(UriPartial.Authority); var expected = new Uri( new Uri(baseUri), "api/model?number=" + model.Number + "&text=" + model.Text); Assert.Equal(expected, actual); }
public object Get(SomeModel queryModel) { return new object(); }
public void GetLinkReturnsCorrectUriForExpressionOfActionWithComplexParameter( [Frozen]HttpRequestMessage request, RouteLinker forComparison, UrlHelper sut, SomeModel someModel) { request.AddDefaultRoute(); var expected = forComparison.GetUri<ModelController>(a => a.Get(someModel)); var actual = sut.GetLink<ModelController>(a => a.Get(someModel)); Assert.Equal(expected, actual); }
public object Get(SomeModel queryModel) { return(new object()); }
public Task<object> Get(SomeModel queryModel) { return Task.Factory.StartNew(() => new object()); }
public Task <object> Get(SomeModel queryModel) { return(Task.Factory.StartNew(() => new object())); }