Upgrade to xunit 2.3.0-beta4 (#1393)

This commit is contained in:
Nate McMaster 2017-08-23 14:51:39 -07:00 committed by GitHub
parent ca184fc2ed
commit 0f5bc9dac8
10 changed files with 31 additions and 20 deletions

View File

@ -12,8 +12,9 @@
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<OwinVersion>3.0.1</OwinVersion>
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion>
<TestSdkVersion>15.3.0</TestSdkVersion>
<XunitAnalyzersVersion>0.6.1</XunitAnalyzersVersion>
<XunitVersion>2.3.0-beta4-build3742</XunitVersion>
<XunitVersionInSpecProjects>2.2.0</XunitVersionInSpecProjects>
</PropertyGroup>
</Project>

View File

@ -31,6 +31,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>

View File

@ -205,14 +205,14 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test
IdentityResultAssert.IsSuccess(await userMgr.CreateAsync(user));
IdentityResultAssert.IsSuccess(await userMgr.AddToRoleAsync(user, roleName));
var roles = await userMgr.GetRolesAsync(user);
Assert.Equal(1, roles.Count());
Assert.Single(roles);
IdentityResultAssert.IsSuccess(await roleMgr.DeleteAsync(role));
Assert.Null(await roleMgr.FindByNameAsync(roleName));
Assert.False(await roleMgr.RoleExistsAsync(roleName));
// REVIEW: We should throw if deleteing a non empty role?
roles = await userMgr.GetRolesAsync(user);
Assert.Equal(0, roles.Count());
Assert.Empty(roles);
}
[ConditionalFact]
@ -233,12 +233,12 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test
IdentityResultAssert.IsSuccess(await userMgr.AddToRoleAsync(user, roleName));
var roles = await userMgr.GetRolesAsync(user);
Assert.Equal(1, roles.Count());
Assert.Single(roles);
IdentityResultAssert.IsSuccess(await userMgr.DeleteAsync(user));
roles = await userMgr.GetRolesAsync(user);
Assert.Equal(0, roles.Count());
Assert.Empty(roles);
}
[ConditionalFact]
@ -387,4 +387,4 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test
Assert.Equal(2, (await manager.GetRolesAsync(userByEmail)).Count);
}
}
}
}

View File

@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>

View File

@ -26,7 +26,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>
</Project>
</Project>

View File

@ -34,6 +34,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Identity.Test
{
var result = new IdentityResult();
Assert.False(result.Succeeded);
Assert.Equal(0, result.Errors.Count());
Assert.Empty(result.Errors);
}
[Fact]
@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Identity.Test
{
var result = IdentityResult.Failed();
Assert.False(result.Succeeded);
Assert.Equal(0, result.Errors.Count());
Assert.Empty(result.Errors);
}
}
}
}

View File

@ -182,7 +182,7 @@ namespace Microsoft.AspNetCore.Identity.Test
IdentityResultAssert.IsFailure(result);
foreach (var error in errors)
{
Assert.True(result.Errors.Any(e => e.Description == error));
Assert.Contains(result.Errors, e => e.Description == error);
}
}
}

View File

@ -132,7 +132,7 @@ namespace Microsoft.AspNetCore.Identity.Test
// Assert
Assert.False(result.Succeeded);
Assert.True(result.IsLockedOut);
Assert.True(logStore.ToString().Contains($"User {user.Id} is currently locked out."));
Assert.Contains($"User {user.Id} is currently locked out.", logStore.ToString());
manager.Verify();
}
@ -163,7 +163,7 @@ namespace Microsoft.AspNetCore.Identity.Test
// Assert
Assert.False(result.Succeeded);
Assert.True(result.IsLockedOut);
Assert.True(logStore.ToString().Contains($"User {user.Id} is currently locked out."));
Assert.Contains($"User {user.Id} is currently locked out.", logStore.ToString());
manager.Verify();
}
@ -493,7 +493,13 @@ namespace Microsoft.AspNetCore.Identity.Test
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public async Task CanResignIn(bool isPersistent, bool externalLogin)
public async Task CanResignIn(
// Suppress warning that says theory methods should use all of their parameters.
// See comments below about why this isn't used.
#pragma warning disable xUnit1026
bool isPersistent,
#pragma warning restore xUnit1026
bool externalLogin)
{
// Setup
var user = new TestUser { UserName = "Foo" };
@ -707,7 +713,7 @@ namespace Microsoft.AspNetCore.Identity.Test
// Assert
Assert.False(result.Succeeded);
Assert.False(checkResult.Succeeded);
Assert.True(logStore.ToString().Contains($"User {user.Id} failed to provide the correct password."));
Assert.Contains($"User {user.Id} failed to provide the correct password.", logStore.ToString());
manager.Verify();
context.Verify();
}

View File

@ -83,13 +83,13 @@ namespace Microsoft.AspNetCore.Identity.Test
// Assert
var manager = userManager.Object;
Assert.NotNull(identity);
Assert.Equal(1, principal.Identities.Count());
Assert.Single(principal.Identities);
Assert.Equal(IdentityConstants.ApplicationScheme, identity.AuthenticationType);
var claims = identity.Claims.ToList();
Assert.NotNull(claims);
Assert.True(
claims.Any(c => c.Type == manager.Options.ClaimsIdentity.UserNameClaimType && c.Value == user.UserName));
Assert.True(claims.Any(c => c.Type == manager.Options.ClaimsIdentity.UserIdClaimType && c.Value == user.Id));
Assert.Contains(
claims, c => c.Type == manager.Options.ClaimsIdentity.UserNameClaimType && c.Value == user.UserName);
Assert.Contains(claims, c => c.Type == manager.Options.ClaimsIdentity.UserIdClaimType && c.Value == user.Id);
Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Admin"));
Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Local"));
foreach (var cl in userClaims)