dotnet-sdk/test/Dapr.AspNetCore.Integration.../RoutingIntegrationTest.cs

36 lines
1.2 KiB
C#

// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
namespace Dapr.AspNetCore.IntegrationTest
{
using System.Net.Http;
using System.Threading.Tasks;
using Dapr.AspNetCore.IntegrationTest.App;
using FluentAssertions;
using Xunit;
public class RoutingIntegrationTest
{
[Fact]
public async Task StateClient_CanBindFromState()
{
using (var factory = new AppWebApplicationFactory())
{
var httpClient = factory.CreateClient();
var stateClient = factory.StateClient;
await stateClient.SaveStateAsync("test", new Widget() { Size = "small", Count = 17, });
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/routingwithstateentry/test");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var widget = await stateClient.GetStateAsync<Widget>("test");
widget.Count.Should().Be(18);
}
}
}
}