Ejemplo n.º 1
0
        protected void BaseArrange()
        {
            IlrRepository = new Mock <IIlrRepository>();
            IlrRepository.Setup(r => r.Get(LearnerOne.Uln, LearnerOne.StdCode)).ReturnsAsync(LearnerOne);
            IlrRepository.Setup(r => r.Get(LearnerTwo.Uln, LearnerTwo.StdCode)).ReturnsAsync(LearnerTwo);
            IlrRepository.Setup(r => r.Get(LearnerThree.Uln, LearnerThree.StdCode)).ReturnsAsync(LearnerThree);
            IlrRepository.Setup(r => r.Get(LearnerFive.Uln, LearnerFive.StdCode)).ReturnsAsync(LearnerFive);

            IlrRepository
            .Setup(c => c.Update(It.IsAny <Ilr>()))
            .Returns(Task.CompletedTask)     // Handle null returning async for Moq callback
            .Callback <Ilr>((ilr) => ModifiedIlr = ilr);

            CertificateRepository = new Mock <ICertificateRepository>();
            CertificateRepository.Setup(r => r.GetCertificate(LearnerOne.Uln, LearnerOne.StdCode)).ReturnsAsync(LearnerOneCertificate);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerTwo.Uln, LearnerTwo.StdCode)).ReturnsAsync((Certificate)null);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerThree.Uln, LearnerThree.StdCode)).ReturnsAsync(LearnerThreeCertificate);

            Sut = new ImportLearnerDetailHandler(IlrRepository.Object, CertificateRepository.Object,
                                                 new Mock <ILogger <ImportLearnerDetailHandler> >().Object);
        }
        protected void BaseArrange()
        {
            IlrRepository = new Mock <IIlrRepository>();
            IlrRepository.Setup(r => r.Get(LearnerWithCertificate.Uln, LearnerWithCertificate.StdCode)).ReturnsAsync(LearnerWithCertificate);
            IlrRepository.Setup(r => r.Get(LearnerWithoutCertificate.Uln, LearnerWithoutCertificate.StdCode)).ReturnsAsync(LearnerWithoutCertificate);
            IlrRepository.Setup(r => r.Get(LearnerWithDeletedCertificate.Uln, LearnerWithDeletedCertificate.StdCode)).ReturnsAsync(LearnerWithDeletedCertificate);
            IlrRepository.Setup(r => r.Get(LearnerWithDraftCertificate.Uln, LearnerWithDraftCertificate.StdCode)).ReturnsAsync(LearnerWithDraftCertificate);
            IlrRepository.Setup(r => r.Get(LearnerWithFailCertificate.Uln, LearnerWithFailCertificate.StdCode)).ReturnsAsync(LearnerWithFailCertificate);

            IlrRepository
            .Setup(c => c.Update(It.IsAny <Ilr>()))
            .Returns(Task.CompletedTask)     // Handle null returning async for Moq callback
            .Callback <Ilr>((ilr) => ModifiedIlr = ilr);

            CertificateRepository = new Mock <ICertificateRepository>();
            CertificateRepository.Setup(r => r.GetCertificate(LearnerWithCertificate.Uln, LearnerWithCertificate.StdCode)).ReturnsAsync(SubmittedCertificateForLearner);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerWithoutCertificate.Uln, LearnerWithoutCertificate.StdCode)).ReturnsAsync((Certificate)null);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerWithDeletedCertificate.Uln, LearnerWithDeletedCertificate.StdCode)).ReturnsAsync(DeletedCertificateForLearner);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerWithDraftCertificate.Uln, LearnerWithDraftCertificate.StdCode)).ReturnsAsync(DraftCertificateForLearner);
            CertificateRepository.Setup(r => r.GetCertificate(LearnerWithFailCertificate.Uln, LearnerWithFailCertificate.StdCode)).ReturnsAsync(FailCertificateForLearner);

            Sut = new ImportLearnerDetailHandler(IlrRepository.Object, CertificateRepository.Object,
                                                 new Mock <ILogger <ImportLearnerDetailHandler> >().Object);
        }