Skip to content

Commit 8becfbf

Browse files
committed
Change E2E class Fixture to allow parallel running
1 parent ec69a7b commit 8becfbf

File tree

160 files changed

+874
-1055
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+874
-1055
lines changed

src/Microsoft.AspNet.OData.Shared/Builder/Conventions/Attributes/PageAttributeEdmTypeConvention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override void Apply(StructuralTypeConfiguration edmTypeConfiguration, ODa
4545
}
4646
else
4747
{
48-
querySettings.MaxTop = pageAttribute.MaxTop;
48+
querySettings.MaxTop = pageAttribute.MaxTop;
4949
}
5050

5151
if (pageAttribute.PageSize > 0)

src/Microsoft.AspNetCore.OData/Extensions/ODataRouteBuilderExtensions.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public static IRouteBuilder SetDefaultQuerySettings(this IRouteBuilder builder,
4444
throw Error.ArgumentNull("defaultQuerySettings");
4545
}
4646

47-
if (!defaultQuerySettings.MaxTop.HasValue || defaultQuerySettings.MaxTop > 0)
48-
{
49-
ModelBoundQuerySettings.DefaultModelBoundQuerySettings.MaxTop = defaultQuerySettings.MaxTop;
50-
}
47+
//if (!defaultQuerySettings.MaxTop.HasValue || defaultQuerySettings.MaxTop > 0)
48+
//{
49+
// ModelBoundQuerySettings.DefaultModelBoundQuerySettings.MaxTop = defaultQuerySettings.MaxTop;
50+
//}
5151

5252
DefaultQuerySettings querySettings = builder.ServiceProvider.GetRequiredService<DefaultQuerySettings>();
5353
if (querySettings == null)
@@ -91,10 +91,6 @@ public static IRouteBuilder MaxTop(this IRouteBuilder builder, int? maxTopValue)
9191

9292
DefaultQuerySettings defaultQuerySettings = builder.GetDefaultQuerySettings();
9393
defaultQuerySettings.MaxTop = maxTopValue;
94-
if (!maxTopValue.HasValue || maxTopValue > 0)
95-
{
96-
ModelBoundQuerySettings.DefaultModelBoundQuerySettings.MaxTop = maxTopValue;
97-
}
9894

9995
return builder;
10096
}

test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Aggregation/AggregationTests.cs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717

1818
namespace Microsoft.Test.E2E.AspNet.OData.Aggregation
1919
{
20-
public class AggregationTestsEFClassic: AggregationTests
20+
public class AggregationTestsEFClassic: AggregationTests<AggregationTestsEFClassic>
2121
{
22-
public AggregationTestsEFClassic(WebHostTestFixture fixture)
22+
public AggregationTestsEFClassic(WebHostTestFixture<AggregationTestsEFClassic> fixture)
2323
: base(fixture)
2424
{
2525
}
2626

27-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
27+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
2828
{
2929
configuration.AddControllers(typeof(CustomersController));
30-
base.UpdateConfiguration(configuration);
30+
31+
UpdateConfigureOnBase(configuration);
3132
}
3233

3334
[Theory]
@@ -54,50 +55,50 @@ public async Task CustomAggregateStdDevWorks(string query)
5455
}
5556

5657
#if NETCORE
57-
public class AggregationTestsEFCoreInMemory : AggregationTests
58+
public class AggregationTestsEFCoreInMemory : AggregationTests<AggregationTestsEFCoreInMemory>
5859
{
59-
public AggregationTestsEFCoreInMemory(WebHostTestFixture fixture)
60+
public AggregationTestsEFCoreInMemory(WebHostTestFixture<AggregationTestsEFCoreInMemory> fixture)
6061
: base(fixture)
6162
{
6263
}
6364

64-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
65+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
6566
{
6667
configuration.AddControllers(typeof(CoreCustomersController<AggregationContextCoreInMemory>));
67-
base.UpdateConfiguration(configuration);
68+
69+
UpdateConfigureOnBase(configuration);
6870
}
6971
}
7072

71-
public class AggregationTestsEFCoreSql : AggregationTests
73+
public class AggregationTestsEFCoreSql : AggregationTests<AggregationTestsEFCoreSql>
7274
{
73-
public AggregationTestsEFCoreSql(WebHostTestFixture fixture)
75+
public AggregationTestsEFCoreSql(WebHostTestFixture<AggregationTestsEFCoreSql> fixture)
7476
: base(fixture)
7577
{
7678
}
7779

78-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
80+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
7981
{
8082
configuration.AddControllers(typeof(CoreCustomersController<AggregationContextCoreSql>));
81-
base.UpdateConfiguration(configuration);
83+
84+
UpdateConfigureOnBase(configuration);
8285
}
8386
}
8487
#endif
8588

8689

8790
#if !NETCORE
88-
public class LinqToSqlAggregationTests : WebHostTestBase
91+
public class LinqToSqlAggregationTests : WebHostTestBase<LinqToSqlAggregationTests>
8992
{
9093
protected string AggregationTestBaseUrl => "{0}/aggregation/Customers";
9194

92-
public LinqToSqlAggregationTests(WebHostTestFixture fixture)
95+
public LinqToSqlAggregationTests(WebHostTestFixture<LinqToSqlAggregationTests> fixture)
9396
: base(fixture)
9497
{
9598
}
9699

97-
98-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
100+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
99101
{
100-
101102
configuration.AddControllers(typeof(LinqToSqlCustomersController));
102103
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
103104
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);
@@ -128,16 +129,16 @@ public async Task ApplyThrows()
128129
}
129130
#endif
130131

131-
public abstract class AggregationTests : WebHostTestBase
132+
public abstract class AggregationTests<T> : WebHostTestBase<T>
132133
{
133134
protected string AggregationTestBaseUrl => "{0}/aggregation/Customers";
134135

135-
public AggregationTests(WebHostTestFixture fixture)
136+
public AggregationTests(WebHostTestFixture<T> fixture)
136137
:base(fixture)
137138
{
138139
}
139140

140-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
141+
protected static void UpdateConfigureOnBase(WebRouteConfiguration configuration)
141142
{
142143
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
143144
configuration.Count().Filter().OrderBy().Expand().MaxTop(null);

test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Aggregation/PagedAggregationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
namespace Microsoft.Test.E2E.AspNet.OData.Aggregation
1515
{
16-
public class PagedAggregationTests : WebHostTestBase
16+
public class PagedAggregationTests : WebHostTestBase<PagedAggregationTests>
1717
{
1818
private const string AggregationTestBaseUrl = "{0}/pagedaggregation/Customers";
1919

20-
public PagedAggregationTests(WebHostTestFixture fixture)
20+
public PagedAggregationTests(WebHostTestFixture<PagedAggregationTests> fixture)
2121
:base(fixture)
2222
{
2323
}
2424

25-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
25+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
2626
{
2727
configuration.AddControllers(typeof (Paged.CustomersController));
2828
configuration.JsonReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,65 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4+
using System.Collections.Generic;
45
using System.Linq;
56
using Microsoft.AspNet.OData;
67

78
namespace Microsoft.Test.E2E.AspNet.OData.Aggregation.Paged
89
{
9-
public class CustomersController : BaseCustomersController
10+
public class CustomersController
1011
{
1112
[EnableQuery(PageSize = 5)]
1213
public IQueryable<Customer> Get()
1314
{
14-
ResetDataSource();
15-
var db = new AggregationContext();
16-
return db.Customers;
15+
return Generate().AsQueryable<Customer>();
16+
}
17+
18+
public IList<Customer> Generate()
19+
{
20+
IList<Customer> customers = new List<Customer>();
21+
for (int i = 1; i < 10; i++)
22+
{
23+
var customer = new Customer
24+
{
25+
Id = i,
26+
Name = "Customer" + i % 2,
27+
Bucket = i % 2 == 0 ? (CustomerBucket?)CustomerBucket.Small : null,
28+
Order = new Order
29+
{
30+
Id = i,
31+
Name = "Order" + i % 2,
32+
Price = i * 100
33+
},
34+
Address = new Address
35+
{
36+
Name = "City" + i % 2,
37+
Street = "Street" + i % 2,
38+
}
39+
};
40+
41+
customers.Add(customer);
42+
}
43+
44+
customers.Add(new Customer()
45+
{
46+
Id = 10,
47+
Name = null,
48+
Bucket = CustomerBucket.Big,
49+
Address = new Address
50+
{
51+
Name = "City1",
52+
Street = "Street",
53+
},
54+
Order = new Order
55+
{
56+
Id = 10,
57+
Name = "Order" + 10 % 2,
58+
Price = 0
59+
},
60+
});
61+
62+
return customers;
1763
}
1864
}
1965
}

test/E2ETest/Microsoft.Test.E2E.AspNet.OData/AlternateKeys/AlternateKeysTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
namespace Microsoft.Test.E2E.AspNet.OData.AlternateKeys
2121
{
22-
public class AlternateKeysTest : WebHostTestBase
22+
public class AlternateKeysTest : WebHostTestBase<AlternateKeysTest>
2323
{
24-
public AlternateKeysTest(WebHostTestFixture fixture)
24+
public AlternateKeysTest(WebHostTestFixture<AlternateKeysTest> fixture)
2525
:base(fixture)
2626
{
2727
}
2828

29-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
29+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
3030
{
3131
var controllers = new[]
3232
{

test/E2ETest/Microsoft.Test.E2E.AspNet.OData/AutoExpand/AutoExpandTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
namespace Microsoft.Test.E2E.AspNet.OData.AutoExpand
1717
{
18-
public class AutoExpandTests : WebHostTestBase
18+
public class AutoExpandTests : WebHostTestBase<AutoExpandTests>
1919
{
2020
private const string AutoExpandTestBaseUrl = "{0}/autoexpand/Customers(5)";
2121

22-
public AutoExpandTests(WebHostTestFixture fixture)
22+
public AutoExpandTests(WebHostTestFixture<AutoExpandTests> fixture)
2323
:base(fixture)
2424
{
2525
}
@@ -39,18 +39,18 @@ public static TheoryDataSet<string, int> AutoExpandTestData
3939
}
4040
}
4141

42-
protected override void UpdateConfiguration(WebRouteConfiguration configuration)
42+
protected static void UpdateConfigure(WebRouteConfiguration configuration)
4343
{
4444
configuration.AddControllers(
45-
typeof (CustomersController),
45+
typeof (CustomersController),
4646
typeof (PeopleController),
4747
typeof (NormalOrdersController));
4848
configuration.JsonReferenceLoopHandling =
4949
Newtonsoft.Json.ReferenceLoopHandling.Ignore;
5050
configuration.Count().Filter().OrderBy().Expand().MaxTop(null).Select();
5151
configuration.MapODataServiceRoute(
52-
"autoexpand",
53-
"autoexpand",
52+
"autoexpand",
53+
"autoexpand",
5454
AutoExpandEdmModel.GetEdmModel(configuration));
5555
}
5656

0 commit comments

Comments
 (0)