public async Task QuestionCreateCommandTriggersEventToUpdateQueryDbWithQuestion() { var questionText = "Test Question 1"; //Arrange var command = new QuestionCreateCommand(questionText); await _commandBus.Send(command); //Act var questions = await _questionRepo.FindByAsync(q => q.Id == 1).ConfigureAwait(false); var question = questions.FirstOrDefault(); //Act Assert.IsNotNull(question); Assert.AreEqual(questionText, question.Text); }
public async Task QuestionDeleteCommandTriggersEventToDeleteQuestionFromQueryDb() { //Arrange var command = new QuestionCreateCommand("Test Question 1"); await _commandBus.Send(command); var questions = await _questionRepo.FindByAsync(q => q.Id == 1).ConfigureAwait(false); var question = questions.FirstOrDefault(); //Act Assert.IsNotNull(question); var command2 = new QuestionDeleteCommand(1, 0); await _commandBus.Send(command2).ConfigureAwait(false); var questionAfterDelete = (await _questionRepo.FindByAsync(q => q.Id == 1).ConfigureAwait(false)).FirstOrDefault(); //Act Assert.IsNull(questionAfterDelete); }