Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit bf0b0e2

Browse files
author
Nate McMaster
committed
Upgrade test framework versions and fix test issues
1 parent 043f8fd commit bf0b0e2

20 files changed

+30
-64
lines changed

build/dependencies.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<CoreFxVersion>4.3.0</CoreFxVersion>
55
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
66
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
7-
<TestSdkVersion>15.0.0</TestSdkVersion>
8-
<XunitVersion>2.2.0</XunitVersion>
7+
<TestSdkVersion>15.3.0-*</TestSdkVersion>
8+
<XunitVersion>2.3.0-beta2-*</XunitVersion>
99
</PropertyGroup>
1010
</Project>

test/Microsoft.AspNetCore.Authentication.Core.Test/Microsoft.AspNetCore.Authentication.Core.Test.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,4 @@
1212
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
1414
</ItemGroup>
15-
<ItemGroup>
16-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
17-
</ItemGroup>
18-
1915
</Project>

test/Microsoft.AspNetCore.Authentication.Core.Test/TokenExtensionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public void SubsequentStoreTokenDeletesPreviousTokens()
5050
props.StoreTokens(new[] { new AuthenticationToken { Name = "Zero", Value = "0" } });
5151

5252
Assert.Equal("0", props.GetTokenValue("Zero"));
53-
Assert.Equal(null, props.GetTokenValue("One"));
54-
Assert.Equal(null, props.GetTokenValue("Two"));
55-
Assert.Equal(null, props.GetTokenValue("Three"));
53+
Assert.Null(props.GetTokenValue("One"));
54+
Assert.Null(props.GetTokenValue("Two"));
55+
Assert.Null(props.GetTokenValue("Three"));
5656
Assert.Equal(1, props.GetTokens().Count());
5757
}
5858

test/Microsoft.AspNetCore.Http.Abstractions.Tests/FragmentStringTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class FragmentStringTests
1111
public void Equals_EmptyFragmentStringAndDefaultFragmentString()
1212
{
1313
// Act and Assert
14-
Assert.Equal(FragmentString.Empty, default(FragmentString));
14+
Assert.Equal(default(FragmentString), FragmentString.Empty);
1515
Assert.Equal(default(FragmentString), FragmentString.Empty);
1616
// explicitly checking == operator
1717
Assert.True(FragmentString.Empty == default(FragmentString));
@@ -25,7 +25,7 @@ public void NotEquals_DefaultFragmentStringAndNonNullFragmentString()
2525
var fragmentString = new FragmentString("#col=1");
2626

2727
// Act and Assert
28-
Assert.NotEqual(fragmentString, default(FragmentString));
28+
Assert.NotEqual(default(FragmentString), fragmentString);
2929
}
3030

3131
[Fact]

test/Microsoft.AspNetCore.Http.Abstractions.Tests/HostStringTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void Port_ExtractsInvalidPortFromValue(string sourceValue)
7070
var result = hostString.Port;
7171

7272
// Assert
73-
Assert.Equal(null, result);
73+
Assert.Null(result);
7474
}
7575

7676
[Theory]
@@ -97,7 +97,7 @@ public void Ctor_CreatesFromHostAndPort(string sourceHost, int sourcePort, strin
9797
public void Equals_EmptyHostStringAndDefaultHostString()
9898
{
9999
// Act and Assert
100-
Assert.Equal(new HostString(string.Empty), default(HostString));
100+
Assert.Equal(default(HostString), new HostString(string.Empty));
101101
Assert.Equal(default(HostString), new HostString(string.Empty));
102102
// explicitly checking == operator
103103
Assert.True(new HostString(string.Empty) == default(HostString));
@@ -111,7 +111,7 @@ public void NotEquals_DefaultHostStringAndNonNullHostString()
111111
var hostString = new HostString("example.com");
112112

113113
// Act and Assert
114-
Assert.NotEqual(hostString, default(HostString));
114+
Assert.NotEqual(default(HostString), hostString);
115115
}
116116

117117
[Fact]

test/Microsoft.AspNetCore.Http.Abstractions.Tests/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@
1717
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
1818
</ItemGroup>
1919

20-
<ItemGroup>
21-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
22-
</ItemGroup>
23-
2420
</Project>

test/Microsoft.AspNetCore.Http.Abstractions.Tests/PathStringTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void CtorThrows_IfPathDoesNotHaveLeadingSlash()
2020
public void Equals_EmptyPathStringAndDefaultPathString()
2121
{
2222
// Act and Assert
23-
Assert.Equal(PathString.Empty, default(PathString));
23+
Assert.Equal(default(PathString), PathString.Empty);
2424
Assert.Equal(default(PathString), PathString.Empty);
2525
Assert.True(PathString.Empty == default(PathString));
2626
Assert.True(default(PathString) == PathString.Empty);
@@ -35,7 +35,7 @@ public void NotEquals_DefaultPathStringAndNonNullPathString()
3535
var pathString = new PathString("/hello");
3636

3737
// Act and Assert
38-
Assert.NotEqual(pathString, default(PathString));
38+
Assert.NotEqual(default(PathString), pathString);
3939
}
4040

4141
[Fact]

test/Microsoft.AspNetCore.Http.Abstractions.Tests/QueryStringTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void AddNameValue_Success(string query1, string name2, string value2, str
110110
public void Equals_EmptyQueryStringAndDefaultQueryString()
111111
{
112112
// Act and Assert
113-
Assert.Equal(QueryString.Empty, default(QueryString));
113+
Assert.Equal(default(QueryString), QueryString.Empty);
114114
Assert.Equal(default(QueryString), QueryString.Empty);
115115
// explicitly checking == operator
116116
Assert.True(QueryString.Empty == default(QueryString));
@@ -124,7 +124,7 @@ public void NotEquals_DefaultQueryStringAndNonNullQueryString()
124124
var queryString = new QueryString("?foo=1");
125125

126126
// Act and Assert
127-
Assert.NotEqual(queryString, default(QueryString));
127+
Assert.NotEqual(default(QueryString), queryString);
128128
}
129129

130130
[Fact]

test/Microsoft.AspNetCore.Http.Abstractions.Tests/UseMiddlewareTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public async Task UseMiddlewareWithIMiddlewareWorks()
224224
sp.AddService(typeof(IMiddlewareFactory), middlewareFactory);
225225
context.RequestServices = sp;
226226
await app(context);
227-
Assert.Equal(true, context.Items["before"]);
228-
Assert.Equal(true, context.Items["after"]);
227+
Assert.True(Assert.IsType<bool>(context.Items["before"]));
228+
Assert.True(Assert.IsType<bool>(context.Items["after"]));
229229
Assert.NotNull(middlewareFactory.Created);
230230
Assert.NotNull(middlewareFactory.Released);
231231
Assert.IsType(typeof(Middleware), middlewareFactory.Created);
@@ -374,4 +374,4 @@ public MiddlewareMultipleInvokeAndInvokeAsyncStub(RequestDelegate next) { }
374374
public Task InvokeAsync(HttpContext context) => TaskCache.CompletedTask;
375375
}
376376
}
377-
}
377+
}

test/Microsoft.AspNetCore.Http.Extensions.Tests/Microsoft.AspNetCore.Http.Extensions.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@
1818
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
1919
</ItemGroup>
2020

21-
<ItemGroup>
22-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
23-
</ItemGroup>
24-
2521
</Project>

test/Microsoft.AspNetCore.Http.Features.Tests/Microsoft.AspNetCore.Http.Features.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@
1616
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1717
</ItemGroup>
1818

19-
<ItemGroup>
20-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
21-
</ItemGroup>
22-
2319
</Project>

test/Microsoft.AspNetCore.Http.Tests/Features/FormFeatureTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public async Task ReadFormAsync_MultipartWithFile_ReturnsParsedFormCollection(bo
202202
{
203203
Assert.True(body.CanSeek);
204204
var content = reader.ReadToEnd();
205-
Assert.Equal(content, "<html><body>Hello World</body></html>");
205+
Assert.Equal("<html><body>Hello World</body></html>", content);
206206
}
207207

208208
await responseFeature.CompleteAsync();
@@ -250,7 +250,7 @@ public async Task ReadFormAsync_MultipartWithEncodedFilename_ReturnsParsedFormCo
250250
{
251251
Assert.True(body.CanSeek);
252252
var content = reader.ReadToEnd();
253-
Assert.Equal(content, "<html><body>Hello World</body></html>");
253+
Assert.Equal("<html><body>Hello World</body></html>", content);
254254
}
255255

256256
await responseFeature.CompleteAsync();
@@ -297,7 +297,7 @@ public async Task ReadFormAsync_MultipartWithFieldAndFile_ReturnsParsedFormColle
297297
{
298298
Assert.True(body.CanSeek);
299299
var content = reader.ReadToEnd();
300-
Assert.Equal(content, "<html><body>Hello World</body></html>");
300+
Assert.Equal("<html><body>Hello World</body></html>", content);
301301
}
302302

303303
await responseFeature.CompleteAsync();
@@ -324,7 +324,7 @@ public async Task ReadFormAsync_ValueCountLimitExceeded_Throw(bool bufferRequest
324324
context.Features.Set<IFormFeature>(formFeature);
325325

326326
var exception = await Assert.ThrowsAsync<InvalidDataException> (() => context.Request.ReadFormAsync());
327-
Assert.Equal(exception.Message, "Form value count limit 2 exceeded.");
327+
Assert.Equal("Form value count limit 2 exceeded.", exception.Message);
328328
}
329329

330330
[Theory]
@@ -349,7 +349,7 @@ public async Task ReadFormAsync_ValueCountLimitExceededWithFiles_Throw(bool buff
349349
context.Features.Set<IFormFeature>(formFeature);
350350

351351
var exception = await Assert.ThrowsAsync<InvalidDataException> (() => context.Request.ReadFormAsync());
352-
Assert.Equal(exception.Message, "Form value count limit 2 exceeded.");
352+
Assert.Equal("Form value count limit 2 exceeded.", exception.Message);
353353
}
354354

355355
[Theory]

test/Microsoft.AspNetCore.Http.Tests/Internal/ApplicationBuilderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void BuildReturnsCallableDelegate()
1717
var httpContext = new DefaultHttpContext();
1818

1919
app.Invoke(httpContext);
20-
Assert.Equal(httpContext.Response.StatusCode, 404);
20+
Assert.Equal(404, httpContext.Response.StatusCode);
2121
}
2222

2323
[Fact]
@@ -29,7 +29,7 @@ public void PropertiesDictionaryIsDistinctAfterNew()
2929
var builder2 = builder1.New();
3030
builder2.Properties["test"] = "value2";
3131

32-
Assert.Equal(builder1.Properties["test"], "value1");
32+
Assert.Equal("value1", builder1.Properties["test"]);
3333
}
3434
}
3535
}

test/Microsoft.AspNetCore.Http.Tests/Microsoft.AspNetCore.Http.Tests.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
<PropertyGroup>
66
<TargetFramework>netcoreapp2.0</TargetFramework>
7-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
8-
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
97
</PropertyGroup>
108

119
<ItemGroup>
@@ -18,8 +16,4 @@
1816
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1917
</ItemGroup>
2018

21-
<ItemGroup>
22-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
23-
</ItemGroup>
24-
2519
</Project>

test/Microsoft.AspNetCore.Owin.Tests/Microsoft.AspNetCore.Owin.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@
1818
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1919
</ItemGroup>
2020

21-
<ItemGroup>
22-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
23-
</ItemGroup>
24-
2521
</Project>

test/Microsoft.AspNetCore.Owin.Tests/OwinFeatureCollectionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public void OwinHttpEnvironmentCanBeCreated()
3535

3636
var requestFeature = Get<IHttpRequestFeature>(features);
3737
Assert.Equal(requestFeature.Method, HttpMethods.Post);
38-
Assert.Equal(requestFeature.Path, "/path");
39-
Assert.Equal(requestFeature.PathBase, "/pathBase");
40-
Assert.Equal(requestFeature.QueryString, "?name=value");
38+
Assert.Equal("/path", requestFeature.Path);
39+
Assert.Equal("/pathBase", requestFeature.PathBase);
40+
Assert.Equal("?name=value", requestFeature.QueryString);
4141
}
4242

4343
[Fact]

test/Microsoft.AspNetCore.WebUtilities.Tests/HttpRequestStreamReaderTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static async Task Read_ReadInTwoChunks()
124124
var read = await reader.ReadAsync(chars, 4, 3);
125125

126126
// Assert
127-
Assert.Equal(read, 3);
127+
Assert.Equal(3, read);
128128
for (var i = 0; i < 3; i++)
129129
{
130130
Assert.Equal(CharData[i], chars[i + 4]);

test/Microsoft.AspNetCore.WebUtilities.Tests/Microsoft.AspNetCore.WebUtilities.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@
1616
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1717
</ItemGroup>
1818

19-
<ItemGroup>
20-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
21-
</ItemGroup>
22-
2319
</Project>

test/Microsoft.Net.Http.Headers.Tests/Microsoft.Net.Http.Headers.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@
1616
<PackageReference Include="xunit" Version="$(XunitVersion)" />
1717
</ItemGroup>
1818

19-
<ItemGroup>
20-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
21-
</ItemGroup>
22-
2319
</Project>

test/Microsoft.Net.Http.Headers.Tests/NameValueHeaderValueTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void Copy_NameOnly_SuccesfullyCopied()
7272
// Change one value and verify the other is unchanged.
7373
pair0.Value = "othervalue";
7474
Assert.Equal("othervalue", pair0.Value);
75-
Assert.Equal(null, pair1.Value);
75+
Assert.Null(pair1.Value);
7676
}
7777

7878
[Fact]
@@ -90,7 +90,7 @@ public void CopyAsReadOnly_NameOnly_CopiedAndReadOnly()
9090
// Change one value and verify the other is unchanged.
9191
pair0.Value = "othervalue";
9292
Assert.Equal("othervalue", pair0.Value);
93-
Assert.Equal(null, pair1.Value);
93+
Assert.Null(pair1.Value);
9494
Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; });
9595
}
9696

0 commit comments

Comments
 (0)