Commit 6e8c0579 authored by Michael Herndon's avatar Michael Herndon

WIP: Indentity.Tests

- add Bogus lib to the project.
- add Faker dependencies to the service collection
parent 3730a897
......@@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.0" />
<PackageReference Include="Bogus" Version="28.4.4" />
</ItemGroup>
<ItemGroup>
......
......@@ -10,8 +10,7 @@ using Mettle;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
using Bogus;
namespace Tests
{
......@@ -47,7 +46,17 @@ namespace Tests
module.Apply(mb);
});
});
serviceCollection.AddTransient<Faker>((s) => new Faker("en"));
serviceCollection.AddTransient<Faker<User>>((s) => {
return new Faker<User>("en")
.RuleFor(o => o.DisplayName, (f, u) => f.Name.FullName())
.RuleFor(o => o.Pseudonym, (f,u) => u.DisplayName)
.RuleFor(o => o.Email,(f, u) => u.Pseudonym + "@nerdymishka.com")
.RuleFor(o => o.IsActive, (f, u) => true)
.RuleFor(o => o.IsEmailConfirmed, (f, u) => f.PickRandom<Boolean>())
.RuleFor(o => o.IsPhoneConfirmed, (f, u) => f.PickRandom<Boolean>());
});
serviceCollection.AddSingleton<IPasswordAuthenticator>(new PasswordAuthenticator());
serviceCollection.AddTransient<IUserStore<User>, UserStore>();
serviceCollection.AddTransient<UserStore, UserStore>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment