public void Bad_request_should_throw(HubUserNotify.Request request) { var subject = new HubUserNotify.Validator(); Func <Task> action = async() => await subject.Process(request, default); action.Should().Throw <ValidationException>(); }
public void Good_request_should_not_throw() { var request = new HubUserNotify.Request() { UserId = Guid.NewGuid(), Message = "Hello World" }; var subject = new HubUserNotify.Validator(); Func <Task> action = async() => await subject.Process(request, default); action.Should().NotThrow <ValidationException>(); }
public async Task Handle(UserNotification notification, CancellationToken cancellationToken) { var userRequest = new HubUserNotify.Request { UserId = notification.UserId, Message = await this.messageFactory.Create( new Messages.GameState.MessageData { GameId = notification.GameId, PlayerId = notification.UserId }) }; await this.mediator.Send(userRequest); }