Ejemplo n.º 1
0
        public void HandleAsync_ShouldInvokeSpecificMethods()
        {
            var command = new CreateUser
            {
                Email      = "email",
                Password   = "******",
                ResourceId = Guid.NewGuid(),
                Username   = "******"
            };

            _handler.Invoking(async x => await x.HandleAsync(command))
            .Should()
            .NotThrow();

            _userService.Verify(x => x.CreateAsync(command.ResourceId, command.Email, command.Password, command.Username), Times.Once);
            _userService.Verify(x => x.GetOrFailAsync(command.ResourceId), Times.Once);
            _eventPublisher.Verify(x => x.PublishAsync(It.IsAny <UserCreated>()), Times.Once);
        }