From 53a54d9f9141c9b9a4a9d57587d50b523913f253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Foidl?= Date: Tue, 8 Oct 2019 19:48:59 +0200 Subject: [PATCH] Tests for GetHttpProtocolVersion (#14477) --- .../HttpSysGetHttpProtocolVersionTest.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Shared/test/Shared.Tests/HttpSysGetHttpProtocolVersionTest.cs diff --git a/src/Shared/test/Shared.Tests/HttpSysGetHttpProtocolVersionTest.cs b/src/Shared/test/Shared.Tests/HttpSysGetHttpProtocolVersionTest.cs new file mode 100644 index 0000000000..d100660ba2 --- /dev/null +++ b/src/Shared/test/Shared.Tests/HttpSysGetHttpProtocolVersionTest.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Xunit; + +namespace Microsoft.AspNetCore.HttpSys.Internal +{ + public class HttpSysGetHttpProtocolVersionTest + { + public static TheoryData s_data = new TheoryData + { + { new Version(2, 0), "HTTP/2" }, + { new Version(1, 1), "HTTP/1.1" }, + { new Version(1, 0), "HTTP/1.0" }, + { new Version(0, 3), "HTTP/0.3" }, + { new Version(2, 1), "HTTP/2.1" } + }; + + [Theory] + [MemberData(nameof(s_data))] + public void GetHttpProtocolVersion_CorrectIETFVersion(Version version, string expected) + { + var actual = version.GetHttpProtocolVersion(); + + Assert.Equal(expected, actual); + } + } +}