Esempio n. 1
0
        public void AuditLogReFetch_WhenAuditLogIsRubbish()
        {
            var builder   = new ExtractableCohortAuditLogBuilder();
            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == "troll doll dur I invented this cohort myself");

            Assert.IsNull(builder.GetObjectIfAny(moqCohort, RepositoryLocator));
        }
Esempio n. 2
0
        public void AuditLogReFetch_WhenAuditLogIsNull()
        {
            var builder   = new ExtractableCohortAuditLogBuilder();
            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == null);

            Assert.IsNull(builder.GetObjectIfAny(moqCohort, RepositoryLocator));
        }
        private object CreatedFromAspectGetter(object rowObject)
        {
            var ecd = rowObject as ExtractableCohortDescription;

            if (ecd != null)
            {
                var obj = _auditLogBuilder.GetObjectIfAny(ecd.Cohort, Activator.RepositoryLocator);
                return(obj is ExtractionInformation ei ? $"{ei.CatalogueItem.Catalogue}.{ei}" : obj);
            }


            return(null);
        }
Esempio n. 4
0
        public void AuditLogReFetch_ExtractionInformation()
        {
            var builder = new ExtractableCohortAuditLogBuilder();

            var ei   = WhenIHaveA <ExtractionInformation>();
            var desc = builder.GetDescription(ei);

            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == desc);
            var ei2       = builder.GetObjectIfAny(moqCohort, RepositoryLocator);

            Assert.IsNotNull(ei2);
            Assert.IsInstanceOf <ExtractionInformation>(ei2);
            Assert.AreEqual(ei, ei2);
        }
Esempio n. 5
0
        public void AuditLogReFetch_CohortIdentificationConfiguration()
        {
            var builder = new ExtractableCohortAuditLogBuilder();

            var cic  = WhenIHaveA <CohortIdentificationConfiguration>();
            var desc = builder.GetDescription(cic);

            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == desc);
            var cic2      = builder.GetObjectIfAny(moqCohort, RepositoryLocator);

            Assert.IsNotNull(cic2);
            Assert.IsInstanceOf <CohortIdentificationConfiguration>(cic2);
            Assert.AreEqual(cic, cic2);
        }
Esempio n. 6
0
        public void AuditLogReFetch_FileInfo()
        {
            var builder = new ExtractableCohortAuditLogBuilder();

            var fi   = new FileInfo("durdur.txt");
            var desc = builder.GetDescription(fi);

            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == desc);
            var fi2       = builder.GetObjectIfAny(moqCohort, RepositoryLocator);

            Assert.IsNotNull(fi2);
            Assert.IsInstanceOf <FileInfo>(fi2);
            Assert.AreEqual(fi.FullName, ((FileInfo)fi2).FullName);
        }
Esempio n. 7
0
        public void AuditLogReFetch_WhenSourceIsDeleted()
        {
            var builder = new ExtractableCohortAuditLogBuilder();

            var ei   = WhenIHaveA <ExtractionInformation>();
            var desc = builder.GetDescription(ei);

            var moqCohort = Mock.Of <IExtractableCohort>(e => e.AuditLog == desc);

            // delete the source
            ei.DeleteInDatabase();

            // should now return null
            Assert.IsNull(builder.GetObjectIfAny(moqCohort, RepositoryLocator));
        }