Example #1
0
        public void StringContentHelper_Create_WithNullContentType()
        {
            // Act
            var result = StringContentHelper.Create("test", null);

            // Assert
            result.Headers.ContentType.Should().BeNull();
            result.ReadAsStringAsync().Result.Should().Be("test");
        }
Example #2
0
        public void StringContentHelper_Create(string test, string expected)
        {
            // Arrange
            var contentType = MediaTypeHeaderValue.Parse(test);

            // Act
            var result = StringContentHelper.Create("test", contentType);

            // Assert
            result.Headers.ContentType.ToString().Should().Be(expected);
            result.ReadAsStringAsync().Result.Should().Be("test");
        }
Example #3
0
        public async Task When_ErrorMessagePosted_Then_ErrorMessageShouldBePublished(
            ErrorModel model)
        {
            var bus = _webApplicationFactory.Services.GetRequiredService <IBusControl>();
            await bus.StartAsync();

            var client   = _webApplicationFactory.CreateClient();
            var response = await client.PostAsync(ApiPath, StringContentHelper.Create(model));

            response.IsSuccessStatusCode.Should().BeTrue();
            await bus.StopAsync();

            ErrorConsumer.Received.Count.Should().BeGreaterOrEqualTo(1);
        }