aspnetcore/test/Identity.FunctionalTests/RegistrationTests.cs

42 lines
1.3 KiB
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Identity.FunctionalTests
{
public class RegistrationTests
{
[Fact]
public async Task CanRegisterAUser()
{
// Arrange
var client = ServerFactory.CreateDefaultClient();
var userName = $"{Guid.NewGuid()}@example.com";
var password = $"!Test.Password1$";
// Act & Assert
await UserStories.RegisterNewUserAsync(client, userName, password);
}
[Fact]
public async Task CanRegisterWithASocialLoginProvider()
{
// Arrange
var server = ServerFactory.CreateServer(builder =>
builder.ConfigureServices(services => services.SetupTestThirdPartyLogin()));
var client = ServerFactory.CreateDefaultClient(server);
var guid = Guid.NewGuid();
var userName = $"{guid}";
var email = $"{guid}@example.com";
// Act & Assert
await UserStories.RegisterNewUserWithSocialLoginAsync(client, userName, email);
}
}
}