Added RemoteService to RegularTestController

pull/112/head
Halil İbrahim Kalkan 7 years ago
parent a36eeaef86
commit 4be4939bfe

@ -1,6 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.App;
using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.DynamicProxying;
using Volo.Abp.Modularity;
using Volo.Abp.TestApp.Application;
@ -13,6 +16,12 @@ namespace Volo.Abp.Http
{
services.AddAssemblyOf<AbpHttpTestModule>();
services.AddHttpClientProxy<IPeopleAppService>("/");
services.AddHttpClientProxy<IRegularTestController>("/");
services.Configure<MvcOptions>(options =>
{
});
}
}
}

@ -0,0 +1,7 @@
namespace Volo.Abp.Http.DynamicProxying
{
public interface IRegularTestController
{
int IncrementValue(int value);
}
}

@ -1,7 +0,0 @@
namespace Volo.Abp.Http.DynamicProxying
{
public class RegularControllerClientProxy_Tests
{
//TODO: Create a regular MVC Controller and add different parameter bindings, verbs and routes and test client proxy for it!
}
}

@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Http.DynamicProxying
{
[RemoteService] //Automatically enables API explorer and apply ABP conventions.
//[ApiExplorerSettings(IgnoreApi = false)] //alternative
public class RegularTestController : AbpController, IRegularTestController
{
[HttpGet]
[Route("api/regular-test-controller/{value}")]
public int IncrementValue(int value)
{
return value + 1;
}
}
}

@ -0,0 +1,24 @@
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Xunit;
namespace Volo.Abp.Http.DynamicProxying
{
public class RegularTestControllerClientProxy_Tests : AbpHttpTestBase
{
//TODO: Create a regular MVC Controller and add different parameter bindings, verbs and routes and test client proxy for it!
private readonly IRegularTestController _controller;
public RegularTestControllerClientProxy_Tests()
{
_controller = ServiceProvider.GetRequiredService<IRegularTestController>();
}
[Fact]
public void IncrementValue()
{
_controller.IncrementValue(42).ShouldBe(43);
}
}
}
Loading…
Cancel
Save