コード例 #1
0
        public async Task Post_Event_Returns_Status200OK()
        {
            var hostBuilder = HostBuilderFactory.CreateHostBuilder();

            // Build and start the IHost
            var host = await hostBuilder.StartAsync();

            // Create an HttpClient to send requests to the TestServer
            var client = host.GetTestClient();

            var content = new StringContent(
                FakeBuilder.CreateCallbackEvent <MessageEvent>(
                    MessageEvent.CallbackEventTypeValue));

            var response = await client.PostAsync(
                "/events",
                content,
                CancellationToken.None);

            response.EnsureSuccessStatusCode();

            Assert.Equal(
                StatusCodes.Status200OK,
                (int)response.StatusCode);
        }