Skip to content

Commit

Permalink
Change the E2E class Fixture to allow parallel running
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Feb 13, 2020
1 parent b92f2df commit c4a999a
Show file tree
Hide file tree
Showing 154 changed files with 630 additions and 691 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@

namespace Microsoft.Test.E2E.AspNet.OData.Aggregation
{
public class AggregationTestsEFClassic: AggregationTests
public class AggregationTestsEFClassic: AggregationTests<AggregationTestsEFClassic>
{
public AggregationTestsEFClassic(WebHostTestFixture fixture)
public AggregationTestsEFClassic(WebHostTestFixture<AggregationTestsEFClassic> fixture)
: base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.AddControllers(typeof(CustomersController));
base.UpdateConfiguration(configuration);

UpdateConfigureOnBase(configuration);
}

[Theory]
Expand All @@ -54,50 +55,50 @@ public async Task CustomAggregateStdDevWorks(string query)
}

#if NETCORE
public class AggregationTestsEFCoreInMemory : AggregationTests
public class AggregationTestsEFCoreInMemory : AggregationTests<AggregationTestsEFCoreInMemory>
{
public AggregationTestsEFCoreInMemory(WebHostTestFixture fixture)
public AggregationTestsEFCoreInMemory(WebHostTestFixture<AggregationTestsEFCoreInMemory> fixture)
: base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.AddControllers(typeof(CoreCustomersController<AggregationContextCoreInMemory>));
base.UpdateConfiguration(configuration);

UpdateConfigureOnBase(configuration);
}
}

public class AggregationTestsEFCoreSql : AggregationTests
public class AggregationTestsEFCoreSql : AggregationTests<AggregationTestsEFCoreSql>
{
public AggregationTestsEFCoreSql(WebHostTestFixture fixture)
public AggregationTestsEFCoreSql(WebHostTestFixture<AggregationTestsEFCoreSql> fixture)
: base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.AddControllers(typeof(CoreCustomersController<AggregationContextCoreSql>));
base.UpdateConfiguration(configuration);

UpdateConfigureOnBase(configuration);
}
}
#endif


#if !NETCORE
public class LinqToSqlAggregationTests : WebHostTestBase
public class LinqToSqlAggregationTests : WebHostTestBase<LinqToSqlAggregationTests>
{
protected string AggregationTestBaseUrl => "{0}/aggregation/Customers";

public LinqToSqlAggregationTests(WebHostTestFixture fixture)
public LinqToSqlAggregationTests(WebHostTestFixture<LinqToSqlAggregationTests> fixture)
: base(fixture)
{
}


protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{

configuration.AddControllers(typeof(LinqToSqlCustomersController));
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
Expand Down Expand Up @@ -128,16 +129,16 @@ public async Task ApplyThrows()
}
#endif

public abstract class AggregationTests : WebHostTestBase
public abstract class AggregationTests<T> : WebHostTestBase<T>
{
protected string AggregationTestBaseUrl => "{0}/aggregation/Customers";

public AggregationTests(WebHostTestFixture fixture)
public AggregationTests(WebHostTestFixture<T> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigureOnBase(WebRouteConfiguration configuration)
{
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

namespace Microsoft.Test.E2E.AspNet.OData.Aggregation
{
public class PagedAggregationTests : WebHostTestBase
public class PagedAggregationTests : WebHostTestBase<PagedAggregationTests>
{
private const string AggregationTestBaseUrl = "{0}/pagedaggregation/Customers";

public PagedAggregationTests(WebHostTestFixture fixture)
public PagedAggregationTests(WebHostTestFixture<PagedAggregationTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.AddControllers(typeof (Paged.CustomersController));
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

namespace Microsoft.Test.E2E.AspNet.OData.AlternateKeys
{
public class AlternateKeysTest : WebHostTestBase
public class AlternateKeysTest : WebHostTestBase<AlternateKeysTest>
{
public AlternateKeysTest(WebHostTestFixture fixture)
public AlternateKeysTest(WebHostTestFixture<AlternateKeysTest> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
var controllers = new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

namespace Microsoft.Test.E2E.AspNet.OData.AutoExpand
{
public class AutoExpandTests : WebHostTestBase
public class AutoExpandTests : WebHostTestBase<AutoExpandTests>
{
private const string AutoExpandTestBaseUrl = "{0}/autoexpand/Customers(5)";

public AutoExpandTests(WebHostTestFixture fixture)
public AutoExpandTests(WebHostTestFixture<AutoExpandTests> fixture)
:base(fixture)
{
}
Expand All @@ -39,18 +39,18 @@ public static TheoryDataSet<string, int> AutoExpandTestData
}
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.AddControllers(
typeof (CustomersController),
typeof (CustomersController),
typeof (PeopleController),
typeof (NormalOrdersController));
configuration.JsonReferenceLoopHandling =
Newtonsoft.Json.ReferenceLoopHandling.Ignore;
configuration.Count().Filter().OrderBy().Expand().MaxTop(null).Select();
configuration.MapODataServiceRoute(
"autoexpand",
"autoexpand",
"autoexpand",
"autoexpand",
AutoExpandEdmModel.GetEdmModel(configuration));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ public DefaultBatchOrderController()
}
}

public class DefaultBatchHandlerCUDBatchTests : WebHostTestBase
public class DefaultBatchHandlerCUDBatchTests : WebHostTestBase<DefaultBatchHandlerCUDBatchTests>
{
public DefaultBatchHandlerCUDBatchTests(WebHostTestFixture fixture)
public DefaultBatchHandlerCUDBatchTests(WebHostTestFixture<DefaultBatchHandlerCUDBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
Expand Down Expand Up @@ -351,14 +351,14 @@ public async Task CanHandleAutomicityGroupRequestsAndUngroupedRequest_JsonBatch(
}
}

public class DefaultBatchHandlerQueryBatchTests : WebHostTestBase
public class DefaultBatchHandlerQueryBatchTests : WebHostTestBase<DefaultBatchHandlerQueryBatchTests>
{
public DefaultBatchHandlerQueryBatchTests(WebHostTestFixture fixture)
public DefaultBatchHandlerQueryBatchTests(WebHostTestFixture<DefaultBatchHandlerQueryBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.MapODataServiceRoute(
"batch",
Expand Down Expand Up @@ -420,14 +420,14 @@ public async Task CanBatchQueriesWithDataServicesClient()
}


public class DefaultBatchHandlerErrorsBatchTests : WebHostTestBase
public class DefaultBatchHandlerErrorsBatchTests : WebHostTestBase<DefaultBatchHandlerErrorsBatchTests>
{
public DefaultBatchHandlerErrorsBatchTests(WebHostTestFixture fixture)
public DefaultBatchHandlerErrorsBatchTests(WebHostTestFixture<DefaultBatchHandlerErrorsBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.MapODataServiceRoute(
"batch",
Expand Down Expand Up @@ -487,14 +487,14 @@ public async Task SendsIndividualErrorWhenOneOfTheRequestsFails()
}


public class DefaultBatchHandlerLinksBatchTests : WebHostTestBase
public class DefaultBatchHandlerLinksBatchTests : WebHostTestBase<DefaultBatchHandlerLinksBatchTests>
{
public DefaultBatchHandlerLinksBatchTests(WebHostTestFixture fixture)
public DefaultBatchHandlerLinksBatchTests(WebHostTestFixture<DefaultBatchHandlerLinksBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
configuration.MapODataServiceRoute(
"batch",
Expand Down Expand Up @@ -540,14 +540,14 @@ public async Task CanSetLinksInABatchWithDataServicesClient()
}
}

public class DefaultBatchHandlerContinueOnErrorBatchTests : WebHostTestBase
public class DefaultBatchHandlerContinueOnErrorBatchTests : WebHostTestBase<DefaultBatchHandlerContinueOnErrorBatchTests>
{
public DefaultBatchHandlerContinueOnErrorBatchTests(WebHostTestFixture fixture)
public DefaultBatchHandlerContinueOnErrorBatchTests(WebHostTestFixture<DefaultBatchHandlerContinueOnErrorBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.MapODataServiceRoute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ public UnbufferedBatchOrderController()
}
}

public class CUDBatchTests : WebHostTestBase
public class CUDBatchTests : WebHostTestBase<CUDBatchTests>
{
public CUDBatchTests(WebHostTestFixture fixture)
public CUDBatchTests(WebHostTestFixture<CUDBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
Expand Down Expand Up @@ -242,14 +242,14 @@ public async Task CanHandleAbsoluteAndRelativeUrls()
}
}

public class QueryBatchTests : WebHostTestBase
public class QueryBatchTests : WebHostTestBase<QueryBatchTests>
{
public QueryBatchTests(WebHostTestFixture fixture)
public QueryBatchTests(WebHostTestFixture<QueryBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.MapODataServiceRoute(
Expand Down Expand Up @@ -307,14 +307,14 @@ public async Task CanBatchQueriesWithDataServicesClient()
}
}

public class ErrorsBatchTests : WebHostTestBase
public class ErrorsBatchTests : WebHostTestBase<ErrorsBatchTests>
{
public ErrorsBatchTests(WebHostTestFixture fixture)
public ErrorsBatchTests(WebHostTestFixture<ErrorsBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.MapODataServiceRoute(
Expand Down Expand Up @@ -368,14 +368,14 @@ public async Task SendsIndividualErrorWhenOneOfTheRequestsFails()
}
}

public class LinksBatchTests : WebHostTestBase
public class LinksBatchTests : WebHostTestBase<LinksBatchTests>
{
public LinksBatchTests(WebHostTestFixture fixture)
public LinksBatchTests(WebHostTestFixture<LinksBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.MapODataServiceRoute(
Expand Down Expand Up @@ -414,14 +414,14 @@ public virtual async Task CanSetLinksInABatchWithDataServicesClient()
}
}

public class ContinueOnErrorBatchTests : WebHostTestBase
public class ContinueOnErrorBatchTests : WebHostTestBase<ContinueOnErrorBatchTests>
{
public ContinueOnErrorBatchTests(WebHostTestFixture fixture)
public ContinueOnErrorBatchTests(WebHostTestFixture<ContinueOnErrorBatchTests> fixture)
:base(fixture)
{
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
ODataModelBuilder builder = configuration.CreateConventionModelBuilder();
configuration.MapODataServiceRoute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

namespace Microsoft.Test.E2E.AspNet.OData.BoundOperation
{
public class BoundOperationTest : WebHostTestBase
public class BoundOperationTest : WebHostTestBase<BoundOperationTest>
{
private const string CollectionOfEmployee = "Collection(NS.Employee)";
private const string CollectionOfManager = "Collection(NS.Manager)";
private const string Employee = "NS.Employee";
private const string Manager = "NS.Manager";

public BoundOperationTest(WebHostTestFixture fixture)
public BoundOperationTest(WebHostTestFixture<BoundOperationTest> fixture)
:base(fixture)
{
}
Expand All @@ -43,7 +43,7 @@ private async Task<HttpResponseMessage> ResetDatasource()
return responseForPost;
}

protected override void UpdateConfiguration(WebRouteConfiguration configuration)
protected static void UpdateConfigure(WebRouteConfiguration configuration)
{
var controllers = new[] { typeof(EmployeesController), typeof(MetadataController) };
configuration.AddControllers(controllers);
Expand Down
Loading

0 comments on commit c4a999a

Please sign in to comment.