public async Task CreateOrUpdateUserProfile_ProfileDoesntExist_HandlerCreatesProfile()
        {
            _userProfileRepository
            .GetByUserAuthIdAsync(Arg.Any <string>(), Arg.Any <CancellationToken>())
            .Returns(Task.FromResult <UserProfile>(null));

            _unitOfWork
            .CommitAsync(Arg.Any <CancellationToken>())
            .Returns(Task.FromResult(1));

            _userAuthIdUniquenessChecker
            .IsUnique(Arg.Any <string>())
            .Returns(true);

            await _createOrUpdateUserProfileCommandHandler.Handle(CreateCommand(), CancellationToken.None);

            await _unitOfWork.Received().CommitAsync(Arg.Any <CancellationToken>());

            await _userProfileRepository.Received().GetByUserAuthIdAsync(AuthId, Arg.Any <CancellationToken>());

            await _userProfileRepository.Received().AddAsync(Arg.Any <UserProfile>());
        }
 public bool IsBroken()
 {
     return(!_userAuthIdUniquenessChecker.IsUnique(_userAuthId));
 }
 private UserProfile CreateValidUserProfile()
 {
     _userAuthIdUniquenessChecker.IsUnique(Arg.Any <string>()).Returns(true);
     return(CreateUserProfileFromProperties());
 }