public void ChangeUserProfileCommandHandler_Throws_Exception_For_Invalid_User()
        {
            var handler = new ChangeUserProfileCommandHandler(_repository);
            var command = new ChangeUserProfileCommand("*****@*****.**")
            {
                DisplayName = "Test",
                Description = "A test description",
                ShowEmail   = true
            };

            var user = Substitute.For <User>();

            user.Email.Returns("*****@*****.**");
            user.Status.Returns(UserStatus.Inactive);

            Action commandAction = () => {
                var result = handler.Execute(command);
            };

            _context.Users.Add(user);

            commandAction.Should().Throw <InvalidOperationException>();
        }
        public void ChangeUserProfileCommandHandler_Succeeds()
        {
            var handler = new ChangeUserProfileCommandHandler(_repository);
            var command = new ChangeUserProfileCommand("*****@*****.**")
            {
                DisplayName = "Test",
                Description = "A test description",
                ShowEmail   = true
            };

            var user = Substitute.For <User>();

            user.Email.Returns("*****@*****.**");
            user.Status.Returns(UserStatus.Active);

            _context.Users.Add(user);

            var result = handler.Execute(command);

            result.Errors.Should().BeEmpty();
            user.DisplayName.Should().Be("Test");
            user.Description.Should().Be("A test description");
            user.ShowEmail.Should().BeTrue();
        }