public async override Task <CommandResult> ProcessAsync(DeleteQuestion command) { var isQuestionPresent = await _reader.ExistsAsync(command.QuestionId); if (!isQuestionPresent) { throw new DomainValidationException(command.Id, "Question doesn't exist", 15); } var question = new Question(); await _writer.DeleteAsync(command.QuestionId); return(new VoidResult(command.Id, true)); }
public async Task DeleteDocument() { //Init var id = Guid.NewGuid().ToString(); var question = GetSampleQuestion(id); //Action await _writer.CreateOrUpdateAsync(question); var document = await _reader.GetAsync(id); //Pre-Verification Assert.IsNotNull(document); Assert.AreEqual(question, document); //Action await _writer.DeleteAsync(id); document = await _reader.GetAsync(id); //Assert Assert.IsNull(document); }