public void Arrange() { Setup(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111)) .ReturnsAsync(new List<Certificate> { new Certificate { CertificateReference = "00010001", StandardCode = 12, CertificateData = JsonConvert.SerializeObject(new CertificateData {}), CertificateLogs = new List<CertificateLog> { new CertificateLog { Action = CertificateActions.Submit, CertificateData = JsonConvert.SerializeObject(new CertificateData { OverallGrade = "Distinction", AchievementDate = DateTime.UtcNow.AddDays(-2) }) } } } }); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny<long>())) .ReturnsAsync(new List<Domain.Entities.Learner> {new Domain.Entities.Learner() {StdCode = 12, FamilyName = "Lamora"}, new Domain.Entities.Learner() {StdCode = 13, FamilyName = "Lamora"}}); }
public void Arrange() { Setup(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111)) .ReturnsAsync(new List <Certificate> { new Certificate { CertificateReference = "00010001", StandardCode = 12, CertificateData = JsonConvert.SerializeObject(new CertificateData { OverallGrade = "Distinction" }), CertificateLogs = GetCertificateLogs() } }); CertificateRepository.Setup(r => r.GetCertificateLogsFor(It.IsAny <Guid>())) .ReturnsAsync(GetCertificateLogs()); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>())) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 12, FamilyName = "Lamora" } }); }
public void Arrange() { Setup(); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>())) .ReturnsAsync(new List <Domain.Entities.Learner>()); }
public void Arrange() { _learners = new List <Learner>(); _dbContext = new Mock <IFeInterventionsDbContext>(); _dbContext.Setup(db => db.Learners) .Returns(_learners.AsQueryable().BuildMockDbSet().Object); _repository = new LearnerRepository(_dbContext.Object); }
public void Arrange() { Setup(); var certificateId = Guid.NewGuid(); var searchingEpaoOrgId = Guid.NewGuid(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111)) .ReturnsAsync(new List <Certificate> { new Certificate { Id = certificateId, CertificateReference = "00010001", StandardCode = 12, CertificateData = JsonConvert.SerializeObject(new CertificateData { OverallGrade = CertificateGrade.Distinction, LearningStartDate = new DateTime(2015, 06, 01), AchievementDate = new DateTime(2018, 06, 01) }), IsPrivatelyFunded = false, CreatedBy = "username", CertificateLogs = new List <CertificateLog> { new CertificateLog { CertificateData = JsonConvert.SerializeObject(new CertificateData { OverallGrade = CertificateGrade.Distinction, AchievementDate = new DateTime(2018, 06, 01) }), Action = CertificateActions.Submit } } } }); ContactRepository.Setup(cr => cr.GetContact("username")) .ReturnsAsync(new Contact() { DisplayName = "EPAO User from this EAPOrg", OrganisationId = searchingEpaoOrgId }); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>())) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 12, FamilyName = "Lamora" } }); }
public void Arrange() { Setup(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111)) .ReturnsAsync(new List <Certificate>()); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>())) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 12, FamilyName = "Lamora" } }); }
public void Then_a_Search_Log_entry_is_created() { SearchHandler.Handle( new SearchQuery() { Surname = "Lamora", EpaOrgId = "12345", Uln = 1111111111, Username = "******" }, new CancellationToken()).Wait(); LearnerRepository.Verify(r => r.StoreSearchLog(It.Is <SearchLog>(l => l.Username == "username" && l.NumberOfResults == 1 && l.Surname == "Lamora" && l.Uln == 1111111111))); }
public void Arrange() { Setup(); var certificateId = Guid.NewGuid(); var submittingEpaoOrgId = Guid.NewGuid(); var searchingEpaoOrgId = Guid.NewGuid(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111)) .ReturnsAsync(new List <Certificate> { new Certificate { Id = certificateId, CertificateReference = "00010001", StandardCode = 12, CertificateData = JsonConvert.SerializeObject(new CertificateData { OverallGrade = CertificateGrade.Distinction, LearningStartDate = new DateTime(2015, 06, 01), AchievementDate = new DateTime(2018, 06, 01) }), CreatedBy = "differentuser", OrganisationId = submittingEpaoOrgId } }); CertificateRepository.Setup(r => r.GetCertificateLogsFor(certificateId)) .ReturnsAsync(new List <CertificateLog>() { new CertificateLog() { Status = CertificateStatus.Submitted, EventTime = new DateTime(2018, 2, 3, 13, 23, 33), Username = "******" }, new CertificateLog() { Status = CertificateStatus.Draft, EventTime = new DateTime(2018, 2, 3, 13, 23, 32), Username = "******" } }); ContactRepository.Setup(cr => cr.GetContact("differentuser")) .ReturnsAsync(new Contact() { DisplayName = "EPAO User from another EAPOrg", OrganisationId = submittingEpaoOrgId }); ContactRepository.Setup(cr => cr.GetContact("username")) .ReturnsAsync(new Contact() { DisplayName = "EPAO User from this EAPOrg", OrganisationId = searchingEpaoOrgId }); LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>())) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 12, FamilyName = "Lamora" } }); }
//using context instead of config public ActivityController(ApplicationDbContext context) { _activityRepository = new ActivityRepository(context); _learnerRepository = new LearnerRepository(context); _userProfileRepository = new UserProfileRepository(context); }
public void Arrange() { Setup(); var certificateId = Guid.NewGuid(); var searchingEpaoOrgId = Guid.NewGuid(); CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(It.IsAny <long>())) .ReturnsAsync(new List <Certificate>()); StandardService.Setup(s => s.GetAllStandardOptions()).ReturnsAsync( new List <StandardOptions> { new StandardOptions { StandardUId = "ST013_1.0", StandardCode = 13, Version = "1.0", StandardReference = "ST013", CourseOption = new List <string> { "MyOption", "MyOption1", "MyOption2" } }, new StandardOptions { StandardUId = "ST012_1.0", StandardCode = 12, Version = "1.0", StandardReference = "ST012", CourseOption = new List <string> { "MyOption", "MyOption1", "MyOption2" } } }); LearnerRepository.Setup(r => r.SearchForLearnerByUln(1111111111)) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 13, FamilyName = "Lamora", Version = "1.0", CourseOption = "MyOption", VersionConfirmed = true, StandardUId = "ST013_1.0" } }); LearnerRepository.Setup(r => r.SearchForLearnerByUln(2222222222)) .ReturnsAsync(new List <Domain.Entities.Learner> { new Domain.Entities.Learner() { StdCode = 12, FamilyName = "Gamora", Version = "1.0", CourseOption = "", VersionConfirmed = true, StandardUId = "ST012_1.0" } }); }
public LearnerController(ApplicationDbContext context) { _learnerRepository = new LearnerRepository(context); _userProfileRepository = new UserProfileRepository(context); }