Skip to content

CSHARP-4421: Unify all spec tests in single test project #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions tests/MongoDB.Bson.Tests/MongoDB.Bson.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@
<ProjectReference Include="..\MongoDB.Bson.TestHelpers\MongoDB.Bson.TestHelpers.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource LinkBase="Specifications\bson-corpus" Include="..\..\specifications\bson-corpus\**\*.json" />
<EmbeddedResource LinkBase="Specifications\bson-decimal128" Include="..\..\specifications\bson-decimal128\**\*.json" />
<EmbeddedResource LinkBase="Specifications\uuid" Include="..\..\specifications\uuid\**\*.json" />
</ItemGroup>

<ItemGroup>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using MongoDB.Driver.Core.Servers;
using Moq;

namespace MongoDB.Driver.Core.Helpers
namespace MongoDB.Driver.Core.TestHelpers
{
public class MockClusterableServerFactory : IClusterableServerFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using MongoDB.Driver.Core.WireProtocol.Messages;
using MongoDB.Driver.Core.WireProtocol.Messages.Encoders;

namespace MongoDB.Driver.Core.Helpers
namespace MongoDB.Driver.Core.TestHelpers
{
public class MockConnection : IConnection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using Moq;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
using System.Threading;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.Connections;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using Xunit;
using MongoDB.Driver.Core.Connections;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Misc;

namespace MongoDB.Driver.Core.Authentication
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
using System.Threading;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.Helpers;
using Xunit;
using MongoDB.Driver.Core.Connections;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using Xunit;

namespace MongoDB.Driver.Core.Authentication
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
using System.Threading;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.Connections;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using Xunit;
using MongoDB.Driver.Core.Connections;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Misc;

namespace MongoDB.Driver.Core.Authentication
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
using MongoDB.Driver.Core.Clusters.ServerSelectors;
using MongoDB.Driver.Core.Configuration;
using MongoDB.Driver.Core.Events;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.TestHelpers.Logging;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
using MongoDB.Bson.TestHelpers;
using MongoDB.Driver.Core.Configuration;
using MongoDB.Driver.Core.Events;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.TestHelpers.Logging;
using MongoDB.Driver.Core.Tests.Core.Clusters;
using Moq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Configuration;
using MongoDB.Driver.Core.Events;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.TestHelpers.Logging;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
using MongoDB.Driver.Core.Configuration;
using MongoDB.Driver.Core.Connections;
using MongoDB.Driver.Core.Events;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Logging;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.TestHelpers.Logging;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Logging;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using Moq;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.Helpers;
using Xunit;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Authentication;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Core.Compression;
using MongoDB.Driver.Core.Configuration;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using Moq;
using Xunit;

namespace MongoDB.Driver.Core.Connections
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
using MongoDB.Driver.Core.Logging;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.TestHelpers.Logging;
using MongoDB.Driver.Specifications.connection_monitoring_and_pooling;
using Moq;
using Xunit;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using MongoDB.Driver.Core.WireProtocol.Messages.Encoders;
using Moq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
using MongoDB.Driver.Core.TestHelpers;
using MongoDB.Driver.Core.WireProtocol.Messages;
using MongoDB.Driver.Core.WireProtocol.Messages.Encoders;
using Moq;
Expand Down
11 changes: 0 additions & 11 deletions tests/MongoDB.Driver.Core.Tests/MongoDB.Driver.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@
<ProjectReference Include="..\MongoDB.Driver.Core.TestHelpers\MongoDB.Driver.Core.TestHelpers.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource LinkBase="Specifications\connection-monitoring-and-pooling\tests\cmap-format" Include="..\..\specifications\connection-monitoring-and-pooling\tests\cmap-format\*.json" />
<EmbeddedResource LinkBase="Specifications\connection-string" Include="..\..\specifications\connection-string\**\*.json" />
<EmbeddedResource LinkBase="Specifications\initial-dns-seedlist-discovery" Include="..\..\specifications\initial-dns-seedlist-discovery\**\*.json" />
<EmbeddedResource LinkBase="Specifications\max-staleness" Include="..\..\specifications\max-staleness\**\*.json" />
<EmbeddedResource LinkBase="Specifications\read-write-concern" Include="..\..\specifications\read-write-concern\**\*.json" />
<EmbeddedResource LinkBase="Specifications\server-discovery-and-monitoring" Include="..\..\specifications\server-discovery-and-monitoring\**\*.json" />
<EmbeddedResource LinkBase="Specifications\server-selection" Include="..\..\specifications\server-selection\**\*.json" />
<EmbeddedResource LinkBase="Specifications\uri-options" Include="..\..\specifications\uri-options\**\*.json" />
</ItemGroup>

<ItemGroup>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
19 changes: 1 addition & 18 deletions tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,7 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource LinkBase="Specifications\atlas-data-lake-testing" Include="..\..\specifications\atlas-data-lake-testing\**\*.json" />
<EmbeddedResource LinkBase="Specifications\auth" Include="..\..\specifications\auth\**\*.json" />
<EmbeddedResource LinkBase="Specifications\change-streams" Include="..\..\specifications\change-streams\**\*.json" />
<EmbeddedResource LinkBase="Specifications\client-side-encryption" Include="..\..\specifications\client-side-encryption\**\*.json" />
<EmbeddedResource LinkBase="Specifications\collection-management" Include="..\..\specifications\collection-management\**\*.json" />
<EmbeddedResource LinkBase="Specifications\command-logging-and-monitoring" Include="..\..\specifications\command-logging-and-monitoring\**\*.json" />
<EmbeddedResource LinkBase="Specifications\connection-monitoring-and-pooling\tests\logging" Include="..\..\specifications\connection-monitoring-and-pooling\tests\logging\*.json" />
<EmbeddedResource LinkBase="Specifications\crud" Include="..\..\specifications\crud\**\*.json" />
<EmbeddedResource LinkBase="Specifications\load-balancers" Include="..\..\specifications\load-balancers\**\*.json" />
<EmbeddedResource LinkBase="Specifications\read-write-concern" Include="..\..\specifications\read-write-concern\**\*.json" />
<EmbeddedResource LinkBase="Specifications\retryable-reads" Include="..\..\specifications\retryable-reads\**\*.json" />
<EmbeddedResource LinkBase="Specifications\retryable-writes" Include="..\..\specifications\retryable-writes\**\*.json" />
<EmbeddedResource LinkBase="Specifications\server-discovery-and-monitoring" Include="..\..\specifications\server-discovery-and-monitoring\**\*.json" />
<EmbeddedResource LinkBase="Specifications\sessions" Include="..\..\specifications\sessions\**\*.json" />
<EmbeddedResource LinkBase="Specifications\transactions" Include="..\..\specifications\transactions\**\*.json" />
<EmbeddedResource LinkBase="Specifications\transactions-convenient-api" Include="..\..\specifications\transactions-convenient-api\**\*.json" />
<EmbeddedResource LinkBase="Specifications\unified-test-format" Include="..\..\specifications\unified-test-format\**\*.json" />
<EmbeddedResource LinkBase="Specifications\versioned-api" Include="..\..\specifications\versioned-api\**\*.json" />
<EmbeddedResource LinkBase="Specifications\" Include="..\..\specifications\**\*.json" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JamesKovacs no need to split to folders anymore :)
The downside is that GridFS tests are included as resources. I think we can ignore that for now.

</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
using System.Linq;
using System.Text.RegularExpressions;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using MongoDB.Bson.TestHelpers.JsonDrivenTests;
using Xunit;

namespace MongoDB.Bson.Tests.Specifications.bson_corpus
namespace MongoDB.Driver.Tests.Specifications.bson_corpus
{
public class BsonCorpusTestRunner
{
Expand Down Expand Up @@ -300,7 +301,7 @@ private class TestCaseFactory : JsonDrivenTestCaseFactory
#endregion

// protected properties
protected override string PathPrefix => "MongoDB.Bson.Tests.Specifications.bson_corpus.tests.";
protected override string PathPrefix => "MongoDB.Driver.Tests.Specifications.bson_corpus.tests.";

// protected methods
protected override IEnumerable<JsonDrivenTestCase> CreateTestCases(BsonDocument document)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
using System.Linq;
using System.Reflection;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using Xunit;

namespace MongoDB.Bson.Specifications.bson_decimal128
namespace MongoDB.Driver.Tests.Specifications.bson_decimal128
{
public class TestRunner
{
Expand Down Expand Up @@ -158,7 +159,7 @@ private class TestCaseFactory : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
const string prefix = "MongoDB.Bson.Tests.Specifications.bson_decimal128.tests.";
const string prefix = "MongoDB.Driver.Tests.Specifications.bson_decimal128.tests.";
var executingAssembly = typeof(TestCaseFactory).GetTypeInfo().Assembly;
var enumerable = executingAssembly
.GetManifestResourceNames()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
using MongoDB.Driver.Core.ConnectionPools;
using MongoDB.Driver.Core.Connections;
using MongoDB.Driver.Core.Events;
using MongoDB.Driver.Core.Helpers;
using MongoDB.Driver.Core.Logging;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand All @@ -42,7 +41,7 @@
using Moq;
using Xunit;

namespace MongoDB.Driver.Specifications.connection_monitoring_and_pooling
namespace MongoDB.Driver.Tests.Specifications.connection_monitoring_and_pooling
{
[Trait("Category", "Pool")]
public class ConnectionMonitoringAndPoolingTestRunner
Expand Down Expand Up @@ -810,7 +809,7 @@ private void WaitForThread(BsonDocument operation, ConcurrentDictionary<string,
// nested types
private class TestCaseFactory : JsonDrivenTestCaseFactory
{
protected override string PathPrefix => "MongoDB.Driver.Core.Tests.Specifications.connection_monitoring_and_pooling.tests.cmap_format.";
protected override string PathPrefix => "MongoDB.Driver.Tests.Specifications.connection_monitoring_and_pooling.tests.cmap_format.";

protected override IEnumerable<JsonDrivenTestCase> CreateTestCases(BsonDocument document)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using Xunit;
using Xunit.Abstractions;

namespace MongoDB.Driver.Specifications.connection_string
namespace MongoDB.Driver.Tests.Specifications.connection_string
{
public class ConnectionStringTestRunner : LoggableTestClass
{
Expand Down Expand Up @@ -411,8 +411,8 @@ private class TestCaseFactory : JsonDrivenTestCaseFactory
protected override string[] PathPrefixes =>
new[]
{
"MongoDB.Driver.Core.Tests.Specifications.connection_string.tests.",
"MongoDB.Driver.Core.Tests.Specifications.uri_options.tests."
"MongoDB.Driver.Tests.Specifications.connection_string.tests.",
"MongoDB.Driver.Tests.Specifications.uri_options.tests."
};

protected override IEnumerable<JsonDrivenTestCase> CreateTestCases(BsonDocument document)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using System.Threading.Tasks;
using Xunit.Abstractions;

namespace MongoDB.Driver.Specifications.initial_dns_seedlist_discovery
namespace MongoDB.Driver.Tests.Specifications.initial_dns_seedlist_discovery
{
[Trait("Category", "ConnectionString")]
[Trait("Category", "SupportLoadBalancing")]
Expand Down Expand Up @@ -166,7 +166,7 @@ private class TestCaseFactory : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
const string prefix = "MongoDB.Driver.Core.Tests.Specifications.initial_dns_seedlist_discovery.tests.";
const string prefix = "MongoDB.Driver.Tests.Specifications.initial_dns_seedlist_discovery.tests.";
var executingAssembly = typeof(TestCaseFactory).GetTypeInfo().Assembly;
return executingAssembly
.GetManifestResourceNames()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
using System;
using FluentAssertions;
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers.JsonDrivenTests;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Driver.Core.Configuration;
using Xunit;
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Bson.TestHelpers.JsonDrivenTests;

namespace MongoDB.Driver.Specifications.read_write_concern.tests
namespace MongoDB.Driver.Tests.Specifications.read_write_concern.tests
{
public class ConnectionStringTestRunner
{
Expand Down Expand Up @@ -109,7 +109,7 @@ private BsonDocument MassageWriteConcernDocument(BsonDocument writeConcern)

private class TestCaseFactory : JsonDrivenTestCaseFactory
{
protected override string PathPrefix => "MongoDB.Driver.Core.Tests.Specifications.read_write_concern.tests.connection_string.";
protected override string PathPrefix => "MongoDB.Driver.Tests.Specifications.read_write_concern.tests.connection_string.";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using MongoDB.Bson.TestHelpers.XunitExtensions;
using MongoDB.Bson.TestHelpers.JsonDrivenTests;

namespace MongoDB.Driver.Specifications.read_write_concern.tests
namespace MongoDB.Driver.Tests.Specifications.read_write_concern.tests
{
public class DocumentTestRunner
{
Expand Down Expand Up @@ -135,7 +135,7 @@ private BsonDocument MassageWriteConcernDocument(BsonDocument writeConcern)

private class TestCaseFactory : JsonDrivenTestCaseFactory
{
protected override string PathPrefix => "MongoDB.Driver.Core.Tests.Specifications.read_write_concern.tests.document.";
protected override string PathPrefix => "MongoDB.Driver.Tests.Specifications.read_write_concern.tests.document.";
}
}
}
Loading