public async Task Handle_GivenValidPassword_PasswordShouldBeHashedWithBCrypt()
        {
            var clock          = new Mock <IClock>();
            var userQueries    = new Mock <IUserQueries>();
            var userRepository = new Mock <IUserRepository>();
            var unitOfWork     = new Mock <IUnitOfWork>();

            unitOfWork.Setup(x => x.SaveEntitiesAsync(It.IsAny <CancellationToken>())).ReturnsAsync(() => true);
            userRepository.Setup(x => x.UnitOfWork).Returns(unitOfWork.Object);
            userRepository.Setup(x => x.Add(It.IsAny <IUser>()))
            .Callback((IUser user) => { Assert.True(BCrypt.Net.BCrypt.Verify("password", user.PasswordHash)); });

            userQueries.Setup(x => x.CheckForPresenceOfAnyUser())
            .ReturnsAsync(() => new StatusCheckModel(false));

            var handler = new CreateInitialUserCommandHandler(userRepository.Object, clock.Object, userQueries.Object);
            var cmd     = new CreateInitialUserCommand("email-address", "password", "first-name", "last-name");
            await handler.Handle(cmd, CancellationToken.None);
        }
        public async Task Handle_GivenSavingSucceeds_ExpectSuccessfulResult()
        {
            var clock          = new Mock <IClock>();
            var userQueries    = new Mock <IUserQueries>();
            var userRepository = new Mock <IUserRepository>();
            var unitOfWork     = new Mock <IUnitOfWork>();

            unitOfWork.Setup(x => x.SaveEntitiesAsync(It.IsAny <CancellationToken>())).ReturnsAsync(() => true);
            userRepository.Setup(x => x.UnitOfWork).Returns(unitOfWork.Object);

            userQueries.Setup(x => x.CheckForPresenceOfAnyUser())
            .ReturnsAsync(() => new StatusCheckModel(false));

            var handler = new CreateInitialUserCommandHandler(userRepository.Object, clock.Object, userQueries.Object);
            var cmd     = new CreateInitialUserCommand("email-address", "password", "first-name", "last-name");
            var result  = await handler.Handle(cmd, CancellationToken.None);

            Assert.True(result.IsSuccess);
        }