Skip to content

Commit

Permalink
chore: bump NUnit from 3.14.0 to 4.0.0 (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddryck authored Nov 28, 2023
1 parent c37e200 commit ed2de92
Show file tree
Hide file tree
Showing 40 changed files with 396 additions and 179 deletions.
2 changes: 1 addition & 1 deletion DubUrl.Adomd.Testing/DubUrl.Adomd.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
Expand Down
18 changes: 12 additions & 6 deletions DubUrl.Adomd.Testing/Mapping/NativeMapperIntrospectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ public void Locate_OneMapperClass_ClassReturned()
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(PowerBiDesktopMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(PowerBiDesktopMapper)));
});
}

[Test]
Expand All @@ -42,10 +45,13 @@ public void Locate_OneMapperClassWithBrand_ClassReturned()
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).Slug, Is.EqualTo("powerbi"));
Assert.That(result.ElementAt(0).MainColor.Length, Is.EqualTo(7));
Assert.That(result.ElementAt(0).SecondaryColor.Length, Is.EqualTo(7));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).Slug, Is.EqualTo("powerbi"));
Assert.That(result.ElementAt(0).MainColor.Length, Is.EqualTo(7));
Assert.That(result.ElementAt(0).SecondaryColor.Length, Is.EqualTo(7));
});
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion DubUrl.Extensions.Testing/DubUrl.Extensions.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion DubUrl.OleDb.Testing/DubUrl.OleDb.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
Expand Down
7 changes: 5 additions & 2 deletions DubUrl.OleDb.Testing/Rewriting/OleDbRewriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ public void Map_UrlInfoWithUsernamePassword_Authentication()

Assert.That(result, Is.Not.Null);
Assert.That(result, Does.ContainKey(OleDbRewriter.USERNAME_KEYWORD));
Assert.That(result[OleDbRewriter.USERNAME_KEYWORD], Is.EqualTo("user"));
Assert.That(result, Does.ContainKey(OleDbRewriter.PASSWORD_KEYWORD));
Assert.Multiple(() =>
{
Assert.That(result[OleDbRewriter.USERNAME_KEYWORD], Is.EqualTo("user"));
Assert.That(result, Does.ContainKey(OleDbRewriter.PASSWORD_KEYWORD));
});
Assert.That(result[OleDbRewriter.PASSWORD_KEYWORD], Is.EqualTo("pwd"));
}

Expand Down
16 changes: 11 additions & 5 deletions DubUrl.OleDb.Testing/WrapperMapperIntrospectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ public void LocateWrapper_TwoGenericMappersClassesForOneDatabase_WrapperReturned
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(2));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(OdbcMapper)));
Assert.That(result.ElementAt(1).MapperType, Is.EqualTo(typeof(OleDbMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(2));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(OdbcMapper)));
Assert.That(result.ElementAt(1).MapperType, Is.EqualTo(typeof(OleDbMapper)));
});
}

[Test]
Expand All @@ -57,8 +60,11 @@ public void LocateWrapper_TwoGenericMappersClassesForOneDatabaseButAlternative_W
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(OdbcMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(OdbcMapper)));
});
}

}
37 changes: 23 additions & 14 deletions DubUrl.QA/BaseAdomdProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace DubUrl.QA;
public abstract class BaseAdomdProvider
{
protected SchemeMapperBuilder SchemeMapperBuilder { get; set; }
public virtual string SelectPrimitiveTemplate(string type) => "EVALUATE DATATABLE(\"value\", " + type + ", {{$value; format=\"value\"$}})";
protected virtual string SelectPrimitiveTemplate(string type) => "EVALUATE DATATABLE(\"value\", " + type + ", {{$value; format=\"value\"$}})";

[OneTimeSetUp]
public void SetupFixture()
Expand Down Expand Up @@ -68,10 +68,13 @@ protected virtual void QueryCustomerScalarValueWithReader(string sql)
using var cmd = conn.CreateCommand();
cmd.CommandText = sql;
var reader = cmd.ExecuteReader();
Assert.That(reader.Read(), Is.True);
Assert.That(reader.GetInt32(0), Is.EqualTo(1));
Assert.That(reader.GetString(1), Is.EqualTo("Nikola Tesla"));
Assert.That(reader.GetDateTime(2), Is.EqualTo(new DateTime(1856, 10, 7)));
Assert.Multiple(() =>
{
Assert.That(reader.Read(), Is.True);
Assert.That(reader.GetInt32(0), Is.EqualTo(1));
Assert.That(reader.GetString(1), Is.EqualTo("Nikola Tesla"));
Assert.That(reader.GetDateTime(2), Is.EqualTo(new DateTime(1856, 10, 7)));
});
Assert.That(reader.Read(), Is.False);
}

Expand Down Expand Up @@ -316,10 +319,13 @@ protected void QueryCustomerWithDapper(string sql)
using var conn = connectionUrl.Open();
var customers = conn.Query<Dapper.Customer>(sql).ToList();
Assert.That(customers, Has.Count.EqualTo(5));
Assert.That(customers.Select(x => x.CustomerId).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => string.IsNullOrEmpty(x.FullName)), Is.False);
Assert.That(customers.Select(x => x.BirthDate).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => x.BirthDate == DateTime.MinValue), Is.False);
Assert.Multiple(() =>
{
Assert.That(customers.Select(x => x.CustomerId).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => string.IsNullOrEmpty(x.FullName)), Is.False);
Assert.That(customers.Select(x => x.BirthDate).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => x.BirthDate == DateTime.MinValue), Is.False);
});
}

[Test]
Expand All @@ -340,9 +346,12 @@ public virtual void QueryCustomerWithDapperRepository()
var repo = provider.GetRequiredService<ICustomerRepository>();
var customers = repo.GetAllAsync().Result;
Assert.That(customers, Has.Count.EqualTo(5));
Assert.That(customers.Select(x => x.CustomerId).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => string.IsNullOrEmpty(x.FullName)), Is.False);
Assert.That(customers.Select(x => x.BirthDate).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => x.BirthDate == DateTime.MinValue), Is.False);
Assert.Multiple(() =>
{
Assert.That(customers.Select(x => x.CustomerId).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => string.IsNullOrEmpty(x.FullName)), Is.False);
Assert.That(customers.Select(x => x.BirthDate).Distinct().ToList(), Has.Count.EqualTo(5));
Assert.That(customers.Any(x => x.BirthDate == DateTime.MinValue), Is.False);
});
}
}
}
2 changes: 1 addition & 1 deletion DubUrl.QA/DubUrl.QA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<ItemGroup>
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion DubUrl.Testing/DubUrl.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
Expand Down
16 changes: 11 additions & 5 deletions DubUrl.Testing/Locating/OdbcDriver/DriverLocatorFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public void Instantiate_MysqlWithEncoding_CorrectType(EncodingOption encoding)

Assert.That(result, Is.Not.Null);
Assert.That(result, Is.InstanceOf<IDriverLocator>());
Assert.That(result, Is.TypeOf<MySqlConnectorDriverLocator>());
Assert.That(((MySqlConnectorDriverLocator)result).Encoding, Is.EqualTo(encoding));
Assert.Multiple(() =>
{
Assert.That(result, Is.TypeOf<MySqlConnectorDriverLocator>());
Assert.That(((MySqlConnectorDriverLocator)result).Encoding, Is.EqualTo(encoding));
});
}

[Test]
Expand All @@ -67,8 +70,11 @@ public void Instantiate_PostgresqlWithEncodingArchitecture_CorrectType(EncodingO

Assert.That(result, Is.Not.Null);
Assert.That(result, Is.InstanceOf<IDriverLocator>());
Assert.That(result, Is.TypeOf<PostgresqlDriverLocator>());
Assert.That(((PostgresqlDriverLocator)result).Encoding, Is.EqualTo(encoding));
Assert.That(((PostgresqlDriverLocator)result).Architecture, Is.EqualTo(architecture));
Assert.Multiple(() =>
{
Assert.That(result, Is.TypeOf<PostgresqlDriverLocator>());
Assert.That(((PostgresqlDriverLocator)result).Encoding, Is.EqualTo(encoding));
Assert.That(((PostgresqlDriverLocator)result).Architecture, Is.EqualTo(architecture));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ public void Locate_RealTypes_BrandsAssociated()
{
var introspector = new DriverLocatorIntrospector();
var result = introspector.Locate();
Assert.That(result.Any(x => !string.IsNullOrEmpty(x.Slug)), Is.True);
Assert.That(result.All(x => !string.IsNullOrEmpty(x.MainColor)), Is.True);
Assert.That(result.All(x => !string.IsNullOrEmpty(x.SecondaryColor)), Is.True);
Assert.Multiple(() =>
{
Assert.That(result.Any(x => !string.IsNullOrEmpty(x.Slug)), Is.True);
Assert.That(result.All(x => !string.IsNullOrEmpty(x.MainColor)), Is.True);
Assert.That(result.All(x => !string.IsNullOrEmpty(x.SecondaryColor)), Is.True);
});
}
}
7 changes: 5 additions & 2 deletions DubUrl.Testing/Locating/RegexUtils/AnyOfCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public void ToRegex_String_Matching(string[] options, string text)
{
var regex = new AnyOfCapture(options);
var result = Regex.Match(text, regex.ToRegex());
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(text));
Assert.Multiple(() =>
{
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(text));
});
}

[Test]
Expand Down
9 changes: 6 additions & 3 deletions DubUrl.Testing/Locating/RegexUtils/CompositeRegex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ public void ToRegex_WordSpaceVersionSpaceAnyOfSpaceWord_ExpectedResult(string te
{
var regex = new CompositeRegex(new BaseRegex[] { new WordMatch("MariaDB"), new SpaceMatch(), new VersionCapture(), new SpaceMatch(), new AnyOfCapture(new[] { "ANSI", "Unicode" }), new SpaceMatch(), new WordMatch("Driver") });
var result = Regex.Match(text, regex.ToRegex());
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[1].Captures[0].Value, Is.EqualTo(version));
Assert.That(result.Groups[2].Captures[0].Value, Is.EqualTo(encoding));
Assert.Multiple(() =>
{
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[1].Captures[0].Value, Is.EqualTo(version));
Assert.That(result.Groups[2].Captures[0].Value, Is.EqualTo(encoding));
});
}


Expand Down
7 changes: 5 additions & 2 deletions DubUrl.Testing/Locating/RegexUtils/OptionalCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public void ToRegex_String_Matching(string optional, string text, string capture
{
var regex = new OptionalCapture(optional);
var result = Regex.Match(text, regex.ToRegex());
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(capture));
Assert.Multiple(() =>
{
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(capture));
});
}
}
7 changes: 5 additions & 2 deletions DubUrl.Testing/Locating/RegexUtils/VersionCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ public void ToRegex_String_Matching(string text)
{
var regex = new VersionCapture();
var result = Regex.Match(text, regex.ToRegex());
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(text));
Assert.Multiple(() =>
{
Assert.That(result.Success, Is.True);
Assert.That(result.Groups[0].Captures[0].Value, Is.EqualTo(text));
});
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void GetDialect_None_DialectReturned()
var result = mapper.GetDialect();

Assert.That(result, Is.Not.Null.Or.Empty);
Assert.IsInstanceOf<PgsqlDialect>(result);
Assert.That(result, Is.InstanceOf<PgsqlDialect>());
Assert.That(result.Aliases, Does.Contain("pgsql"));
Assert.That(result.Aliases, Does.Contain("pg"));
}
Expand Down
2 changes: 1 addition & 1 deletion DubUrl.Testing/Mapping/Implementation/QuestDbMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void GetDialect_None_DialectReturned()
var result = mapper.GetDialect();

Assert.That(result, Is.Not.Null.Or.Empty);
Assert.IsInstanceOf<QuestDbDialect>(result);
Assert.That(result, Is.InstanceOf<QuestDbDialect>());
Assert.That(result.Aliases, Does.Contain("quest"));
Assert.That(result.Aliases, Does.Contain("questdb"));
}
Expand Down
46 changes: 32 additions & 14 deletions DubUrl.Testing/Mapping/NativeMapperIntrospectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ public void Locate_OneMapperClass_ClassReturned()
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MsSqlServerMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MsSqlServerMapper)));
});
}

[Test]
Expand All @@ -43,10 +46,13 @@ public void Locate_OneMapperClassWithBrand_ClassReturned()
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).Slug, Is.EqualTo("microsoftsqlserver"));
Assert.That(result.ElementAt(0).MainColor.Length, Is.EqualTo(7));
Assert.That(result.ElementAt(0).SecondaryColor.Length, Is.EqualTo(7));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).Slug, Is.EqualTo("microsoftsqlserver"));
Assert.That(result.ElementAt(0).MainColor.Length, Is.EqualTo(7));
Assert.That(result.ElementAt(0).SecondaryColor.Length, Is.EqualTo(7));
});
}

[Test]
Expand All @@ -68,8 +74,11 @@ public void Locate_TwoMapperClassesButOneAlternate_ClassesReturned()
var result = introspector.Locate();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MsSqlServerMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MsSqlServerMapper)));
});
}

[Test]
Expand All @@ -80,8 +89,11 @@ public void LocateAlternative_TwoMapperClassesButOneAlternate_ClassesReturned()
var result = introspector.LocateAlternative();

Assert.That(result, Is.Not.Null);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MySqlDataMapper)));
Assert.Multiple(() =>
{
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.ElementAt(0).MapperType, Is.EqualTo(typeof(MySqlDataMapper)));
});
}

[Test]
Expand All @@ -92,8 +104,11 @@ public void Aliases_TwoMapperClassesIncludingAlternative_Equivalent()
var alternative = introspector.LocateAlternative().ElementAt(0).Aliases;
var primary = introspector.Locate().ElementAt(0).Aliases;

Assert.That(primary, Is.Not.Null.Or.Empty);
Assert.That(alternative, Is.Not.Null.Or.Empty);
Assert.Multiple(() =>
{
Assert.That(primary, Is.Not.Null.Or.Empty);
Assert.That(alternative, Is.Not.Null.Or.Empty);
});
Assert.That(primary, Is.EqualTo(alternative));
}

Expand All @@ -105,8 +120,11 @@ public void DatabaseName_TwoMapperClassesIncludingAlternative_Equivalent()
var alternative = introspector.LocateAlternative().ElementAt(0).DatabaseName;
var primary = introspector.Locate().ElementAt(0).DatabaseName;

Assert.That(primary, Is.Not.Null.Or.Empty);
Assert.That(alternative, Is.Not.Null.Or.Empty);
Assert.Multiple(() =>
{
Assert.That(primary, Is.Not.Null.Or.Empty);
Assert.That(alternative, Is.Not.Null.Or.Empty);
});
Assert.That(primary, Is.EqualTo(alternative));
}
}
Loading

0 comments on commit ed2de92

Please sign in to comment.