Test frameworks consolidated (#12672)

This commit is contained in:
Davide Giacometti
2021-08-16 15:25:06 +02:00
committed by GitHub
parent c3a51f9227
commit e96c0da265
53 changed files with 1018 additions and 924 deletions

View File

@@ -10,9 +10,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -3,55 +3,55 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Plugin.Uri.UriHelper;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Plugin.Uri.UnitTests.UriHelper
{
[TestFixture]
[TestClass]
public class ExtendedUriParserTests
{
[TestCase("google.com", true, "https://google.com/")]
[TestCase("http://google.com", true, "http://google.com/")]
[TestCase("localhost", true, "https://localhost/")]
[TestCase("http://localhost", true, "http://localhost/")]
[TestCase("127.0.0.1", true, "https://127.0.0.1/")]
[TestCase("http://127.0.0.1", true, "http://127.0.0.1/")]
[TestCase("http://127.0.0.1:80", true, "http://127.0.0.1/")]
[TestCase("127", false, null)]
[TestCase("", false, null)]
[TestCase("https://google.com", true, "https://google.com/")]
[TestCase("ftps://google.com", true, "ftps://google.com/")]
[TestCase(null, false, null)]
[TestCase("bing.com/search?q=gmx", true, "https://bing.com/search?q=gmx")]
[TestCase("http://bing.com/search?q=gmx", true, "http://bing.com/search?q=gmx")]
[TestCase("h", true, "https://h/")]
[TestCase("http://h", true, "http://h/")]
[TestCase("ht", true, "https://ht/")]
[TestCase("http://ht", true, "http://ht/")]
[TestCase("htt", true, "https://htt/")]
[TestCase("http://htt", true, "http://htt/")]
[TestCase("http", true, "https://http/")]
[TestCase("http://http", true, "http://http/")]
[TestCase("http:", false, null)]
[TestCase("http:/", false, null)]
[TestCase("http://", false, null)]
[TestCase("http://t", true, "http://t/")]
[TestCase("http://te", true, "http://te/")]
[TestCase("http://tes", true, "http://tes/")]
[TestCase("http://test", true, "http://test/")]
[TestCase("http://test.", false, null)]
[TestCase("http://test.c", true, "http://test.c/")]
[TestCase("http://test.co", true, "http://test.co/")]
[TestCase("http://test.com", true, "http://test.com/")]
[TestCase("http:3", true, "https://http:3/")]
[TestCase("http://http:3", true, "http://http:3/")]
[TestCase("[::]", true, "https://[::]/")]
[TestCase("http://[::]", true, "http://[::]/")]
[TestCase("[2001:0DB8::1]", true, "https://[2001:db8::1]/")]
[TestCase("http://[2001:0DB8::1]", true, "http://[2001:db8::1]/")]
[TestCase("[2001:0DB8::1]:80", true, "https://[2001:db8::1]/")]
[TestCase("http://[2001:0DB8::1]:80", true, "http://[2001:db8::1]/")]
[DataTestMethod]
[DataRow("google.com", true, "https://google.com/")]
[DataRow("http://google.com", true, "http://google.com/")]
[DataRow("localhost", true, "https://localhost/")]
[DataRow("http://localhost", true, "http://localhost/")]
[DataRow("127.0.0.1", true, "https://127.0.0.1/")]
[DataRow("http://127.0.0.1", true, "http://127.0.0.1/")]
[DataRow("http://127.0.0.1:80", true, "http://127.0.0.1/")]
[DataRow("127", false, null)]
[DataRow("", false, null)]
[DataRow("https://google.com", true, "https://google.com/")]
[DataRow("ftps://google.com", true, "ftps://google.com/")]
[DataRow(null, false, null)]
[DataRow("bing.com/search?q=gmx", true, "https://bing.com/search?q=gmx")]
[DataRow("http://bing.com/search?q=gmx", true, "http://bing.com/search?q=gmx")]
[DataRow("h", true, "https://h/")]
[DataRow("http://h", true, "http://h/")]
[DataRow("ht", true, "https://ht/")]
[DataRow("http://ht", true, "http://ht/")]
[DataRow("htt", true, "https://htt/")]
[DataRow("http://htt", true, "http://htt/")]
[DataRow("http", true, "https://http/")]
[DataRow("http://http", true, "http://http/")]
[DataRow("http:", false, null)]
[DataRow("http:/", false, null)]
[DataRow("http://", false, null)]
[DataRow("http://t", true, "http://t/")]
[DataRow("http://te", true, "http://te/")]
[DataRow("http://tes", true, "http://tes/")]
[DataRow("http://test", true, "http://test/")]
[DataRow("http://test.", false, null)]
[DataRow("http://test.c", true, "http://test.c/")]
[DataRow("http://test.co", true, "http://test.co/")]
[DataRow("http://test.com", true, "http://test.com/")]
[DataRow("http:3", true, "https://http:3/")]
[DataRow("http://http:3", true, "http://http:3/")]
[DataRow("[::]", true, "https://[::]/")]
[DataRow("http://[::]", true, "http://[::]/")]
[DataRow("[2001:0DB8::1]", true, "https://[2001:db8::1]/")]
[DataRow("http://[2001:0DB8::1]", true, "http://[2001:db8::1]/")]
[DataRow("[2001:0DB8::1]:80", true, "https://[2001:db8::1]/")]
[DataRow("http://[2001:0DB8::1]:80", true, "http://[2001:db8::1]/")]
public void TryParseCanParseHostName(string query, bool expectedSuccess, string expectedResult)
{
// Arrange