public void ItShouldCreateQuestion() { var command = new AskQuestionCommand { Title = "TheTitleIsMoreThan15", Text = "TheText" }; this.RepositoryMock.Setup(x => x.Add(It.IsNotNull<Question>())).Callback<Question>(x => x.Id = 1); var response = this.Processor.Process(command); Assert.That(response.IsValid); Assert.That(response.QuestionId, Is.EqualTo(1)); }
public async Task <Guid> Add(AskQuestion question) { var command = new AskQuestionCommand(); command.Id = Guid.NewGuid(); command.Title = question.Title; command.Body = question.Body; command.Tags = question.Tags; command.UserId = question.UserId; await _mediator.Send(command); return(command.Id); }