|
|
|
@ -1,7 +1,9 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Shouldly; |
|
|
|
using Volo.Abp.Http.Client; |
|
|
|
using Volo.Abp.Localization; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
namespace Volo.Abp.Http.DynamicProxying |
|
|
|
@ -30,6 +32,25 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
exception.Error.Message.ShouldBe("This is an error message!"); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task GetWithDateTimeParameterAsync() |
|
|
|
{ |
|
|
|
var dateTime1 = new DateTime(2020, 04, 19, 19, 05, 01); |
|
|
|
var result = await _controller.GetWithDateTimeParameterAsync(dateTime1); |
|
|
|
result.ShouldBe(dateTime1); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task GetWithDateTimeParameterAsync_With_Different_Culture() |
|
|
|
{ |
|
|
|
using (CultureHelper.Use("es")) |
|
|
|
{ |
|
|
|
var dateTime1 = new DateTime(2020, 04, 19, 19, 05, 01); |
|
|
|
var result = await _controller.GetWithDateTimeParameterAsync(dateTime1); |
|
|
|
result.ShouldBe(dateTime1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task PostValueWithHeaderAndQueryStringAsync() |
|
|
|
{ |
|
|
|
@ -54,7 +75,7 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
[Fact] |
|
|
|
public async Task PostObjectWithBodyAsync() |
|
|
|
{ |
|
|
|
var result = await _controller.PostObjectWithBodyAsync(new Car { Year = 1976, Model = "Ford" }); |
|
|
|
var result = await _controller.PostObjectWithBodyAsync(new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(1976); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
@ -62,15 +83,26 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
[Fact] |
|
|
|
public async Task PostObjectWithQueryAsync() |
|
|
|
{ |
|
|
|
var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford" }); |
|
|
|
var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(1976); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task PostObjectWithQueryAsync_With_Different_Culture() |
|
|
|
{ |
|
|
|
using (CultureHelper.Use("tr")) |
|
|
|
{ |
|
|
|
var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(1976); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task GetObjectWithUrlAsync() |
|
|
|
{ |
|
|
|
var result = await _controller.GetObjectWithUrlAsync(new Car { Year = 1976, Model = "Ford" }); |
|
|
|
var result = await _controller.GetObjectWithUrlAsync(new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(1976); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
@ -78,7 +110,7 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
[Fact] |
|
|
|
public async Task GetObjectandIdAsync() |
|
|
|
{ |
|
|
|
var result = await _controller.GetObjectandIdAsync(42, new Car { Year = 1976, Model = "Ford" }); |
|
|
|
var result = await _controller.GetObjectandIdAsync(42, new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(42); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
@ -86,7 +118,7 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
[Fact] |
|
|
|
public async Task GetObjectAndIdWithQueryAsync() |
|
|
|
{ |
|
|
|
var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car { Year = 1976, Model = "Ford" }); |
|
|
|
var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car { Year = 1976, Model = "Ford", FirstReleaseDate = new DateTime(1976, 02, 22, 15, 0, 6, 22) }); |
|
|
|
result.Year.ShouldBe(42); |
|
|
|
result.Model.ShouldBe("Ford"); |
|
|
|
} |
|
|
|
@ -97,7 +129,7 @@ namespace Volo.Abp.Http.DynamicProxying |
|
|
|
var result = await _controller.PatchValueWithBodyAsync("mybody"); |
|
|
|
result.ShouldBe("mybody"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task PutValueWithHeaderAndQueryStringAsync() |
|
|
|
{ |
|
|
|
|