protected async Task <int> ExecuteExamCreatedConsumerAsync(TestServer testServer, List <AnswerKeyOpticalForm> answerKeyOpticalForms) { var examId = RandomGen.Next(); var repository = testServer.Host.Services.GetService(typeof(IOpticalFormRepository)); var consumer = new ExamCreatedConsumer(repository as IOpticalFormRepository); var context = Substitute.For <ConsumeContext <IExamCreated> >(); context.Message.ExamId.Returns(examId); context.Message.AnswerKeyOpticalForms.Returns(answerKeyOpticalForms); await consumer.Consume(context); return(examId); }
protected async Task <int> ExecuteExamCreatedConsumerAsync( IAnswerKeyOpticalFormRepository answerKeyOpticalFormRepository, List <AnswerKeyOpticalForm> answerKeyOpticalForms, int examId) { var consumer = new ExamCreatedConsumer(answerKeyOpticalFormRepository); var context = Substitute.For <ConsumeContext <IExamCreated> >(); context.Message.ExamId.Returns(examId); context.Message.AnswerKeyOpticalForms.Returns(answerKeyOpticalForms); await consumer.Consume(context); return(examId); }