public void CanCreateUserWhenUserNotFound()
        {
            // Arrange
            _userByEmailQuery
                .Execute(Arg.Any<UserByEmailParameters>())
                .Returns((VouchercloudUser)null);

            _createUserCommand.Execute(Arg.Any<CreateUserParameters>())
                .Returns(
                    new VouchercloudUser
                    {
                        UserId = 1
                    });

            var service = new UserService(_userByEmailQuery, _createUserCommand, _deleteUserCommand);

            var request = new CreateUser
                          {
                              DateOfBirth = new DateTime(1980, 1, 1),
                              Email = "*****@*****.**",
                              FirstName = "James",
                              LastName = "Harper",
                              Password = "******"
                          };
            // Act
            var response = service.Post(request);

            // Assert
            _createUserCommand
                .Received(1)
                .Execute(Arg.Any<CreateUserParameters>());

            response.Should().NotBeNull();
            response.UserId.Should().Be(1);
        }
        public void HttpErrorThrownWhenCreatingUserAlreadyExists()
        {
            // Arrange
            _userByEmailQuery
                .Execute(Arg.Any<UserByEmailParameters>())
                .Returns(new VouchercloudUser());

            var service = new UserService(_userByEmailQuery, _createUserCommand, _deleteUserCommand);

            var request = new CreateUser
            {
                DateOfBirth = new DateTime(1980, 1, 1),
                Email = "*****@*****.**",
                FirstName = "James",
                LastName = "Harper",
                Password = "******"
            };

            // Act, Assert
            service
                .Invoking(s => s.Post(request))
                .ShouldThrow<HttpError>().And.Message.Should().Be("User already exists");

            _createUserCommand
                .DidNotReceive()
                .Execute(Arg.Any<CreateUserParameters>());
        }