Files
WireMock.Net/test/WireMock.Net.Tests/Util/HttpVersionParserTests.cs
Stef Heyenrath 6ac95cf57d Add Grpc ProtoBuf support (request-response) (#1047)
* ProtoBuf

* .

* x

* ---

* x

* fx

* ...

* sc

* ...

* .

* groen

* x

* fix tests

* ok!?

* fix tests

* fix tests

* !

* x

* 6

* .

* x

* ivaluematcher

* transformer

* .

* sc

* .

* mapping

* x

* tra

* com

* ...

* .

* .

* .

* AddProtoDefinition

* .

* set

* grpahj

* .

* .

* IdOrText

* ...

* async

* async2

* .

* t

* nuget

* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0-preview-04" />

* http version

* tests

* .WithHttpVersion("2")

* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0" />

* HttpVersionParser
2024-02-16 17:16:51 +01:00

39 lines
1.0 KiB
C#

using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests.Util;
[ExcludeFromCodeCoverage]
public class HttpVersionParserTests
{
[Theory]
[InlineData("HTTP/1.1", "1.1")]
[InlineData("HTTP/2", "2")]
[InlineData("http/1.0", "1.0")]
[InlineData("HTTP/3", "3")]
public void Parse_ValidHttpVersion_ReturnsCorrectVersion(string protocol, string expectedVersion)
{
// Act
var version = HttpVersionParser.Parse(protocol);
// Assert
version.Should().Be(expectedVersion, "the input string is a valid HTTP protocol version");
}
[Theory]
[InlineData("HTP/2")]
[InlineData("HTTP/2.2.2")]
[InlineData("HTTP/")]
[InlineData("http//1.1")]
[InlineData("")]
public void Parse_InvalidHttpVersion_ReturnsEmptyString(string protocol)
{
// Act
var version = HttpVersionParser.Parse(protocol);
// Assert
version.Should().BeEmpty("the input string is not a valid HTTP protocol version");
}
}