public void Should_be_possible_identify_when_an_unrecoverable_error_occurs()
        {
            IDocumentSession fakeSession    = provider.GetSession();
            CollectRequest   collectRequest = this.GetCollectRequest();

            session.SaveChanges();
            CollectExecutionManagerFactory factory = new CollectExecutionManagerFactory(collectRequest, session);

            session.SaveChanges();
            List <string> registryObjectsThatNotProcessInFirstTime = new List <string>()
            {
                "oval:org.mitre.oval:obj:4000"
            };
            List <string>           familyObjectsThatNotProcessInFirstTime = new List <string>();
            CollectExecutionManager executionManager = factory.CreateExecutionManagerWWithInvalidCredentialsScenario(this.GetResultForRegistry(collectRequest, registryObjectsThatNotProcessInFirstTime),
                                                                                                                     this.GetResultForFamily(collectRequest, familyObjectsThatNotProcessInFirstTime));

            session.SaveChanges();
            executionManager.ExecuteCollect(fakeSession, collectRequest, FamilyEnumeration.windows);
            session.SaveChanges();
            CollectRequest collectRequestAfterExecute = session.Load <CollectRequest>(collectRequest.Oid.ToString());

            this.CheckTheDefaulStateOfRequestCollectAfterOneExecution(collectRequestAfterExecute);
            Assert.AreEqual(true, collectRequestAfterExecute.GetCollectExecutions(session).First().ProbeExecutions.First().HasErrors());

            Assert.IsTrue(collectRequestAfterExecute.isClosed(), "the request Collect is not closed");
        }
Beispiel #2
0
        private DateTime GetCollectionStartDate(IDocumentSession session, CollectRequest collectRequest)
        {
            var firstExecution = collectRequest.GetCollectExecutions(session).FirstOrDefault();

            if (firstExecution != null)
            {
                return(firstExecution.StartDate.ToUniversalTime());
            }

            var collectPackage = Repository.GetCollectPackages(session, new[] { collectRequest.CollectPackageId }).First();

            return(collectPackage.ScheduleInformation.ExecutionDate);
        }