public void LogOutUserCommandHandler_Succeeds()
        {
            var handler = new LogOutUserCommandHandler(_repository);
            var command = new LogOutUserCommand("*****@*****.**");
            var user    = Substitute.For <User>();

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

            _context.Users.Add(user);

            var result = handler.Execute(command);

            result.Success.Should().BeTrue();
            user.Received().LogOut();
        }
        public void LogOutUserCommandHandler_Throws_Exception_For_Invalid_User()
        {
            var handler = new LogOutUserCommandHandler(_repository);
            var command = new LogOutUserCommand("*****@*****.**");
            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>();
            user.DidNotReceive().LogOut();
        }