public async Task ValidateAsync_DuplicateEmailAddress_ReturnsFailure()
        {
            const string duplicateEmailAddress = "*****@*****.**";

            var context = ApplicationUserValidatorTestContext.Setup();

            context.ApplicationUserByEmail = ApplicationUserBuilder
                                             .Create()
                                             .WithEmailAddress(duplicateEmailAddress)
                                             .Build();

            var sut = context.ApplicationUserValidator;

            var user = ApplicationUserBuilder
                       .Create()
                       .WithEmailAddress(duplicateEmailAddress)
                       .Build();

            var actual = await sut.ValidateAsync(user);

            var expected = Result.Failure(new List <ErrorDetails> {
                new ErrorDetails("EmailAlreadyExists", "EmailAddress")
            });

            actual.Should().Be(expected);
        }
        public async Task ValidateAsync_ValidApplicationUser_ReturnsSuccess()
        {
            var context = ApplicationUserValidatorTestContext.Setup();
            var sut     = context.ApplicationUserValidator;

            var user = ApplicationUserBuilder
                       .Create()
                       .Build();

            var actual = await sut.ValidateAsync(user);

            actual.Should().Be(Result.Success());
        }
        public async Task ValidateAsync_WithEmailAddress_ReturnsFailure(string input, string[] errorMessageIds)
        {
            var context = ApplicationUserValidatorTestContext.Setup();
            var sut     = context.ApplicationUserValidator;

            var user = ApplicationUserBuilder
                       .Create()
                       .WithEmailAddress(input)
                       .Build();

            var actual = await sut.ValidateAsync(user);

            var expected = Result.Failure(errorMessageIds.Select(id => new ErrorDetails(id, "EmailAddress")));

            actual.Should().Be(expected);
        }