Пример #1
0
 /// <summary>
 /// Configures the request collect with one probeExecute with the error status.
 /// </summary>
 /// <param name="collectRequest">The request collect.</param>
 /// <param name="probe">The probe.</param>
 /// <param name="collectExecution">The collect execution.</param>
 /// <param name="error">The error.</param>
 private void ConfigureTheCollectRequestWithAnErrorProbeExecute(CollectRequest collectRequest, string probeCapability, CollectExecution collectExecution, Exception error, ExecutionLogBuilder executionLog)
 {
     executionLog.AnErrorOccurred(error.Message);
     executionLog.EndCollect();
     ProbeExecution executionWithError = collectFactory.CreateAProbeExecutionWithError(probeCapability, executionLog.BuildExecutionLogs());
     collectExecution.ProbeExecutions.Add(executionWithError);
 }
Пример #2
0
        public void Should_be_possible_to_build_an_execution_log_in_steps_with_custom_errors_logs()
        {
            ExecutionLogBuilder executionLog = new ExecutionLogBuilder();
            executionLog.StartCollectOf("Registry");
            executionLog.TryConnectToHost("176.16.3.166");

            executionLog.AnErrorOccurred("Erro trying connect to host 176.16.3.166");

            executionLog.CollectingInformationFrom("oval:id:7589");
            executionLog.EndCollect();
            IEnumerable<ProbeLogItem> executionsLog = executionLog.BuildExecutionLogs();
            Assert.AreEqual(5, executionsLog.Count());
            Assert.AreEqual(TypeItemLog.Error, executionsLog.ElementAt(2).Type);
        }
Пример #3
0
        public void Should_be_possible_to_build_a_probeExecution_with_error_status_and_execution_logs_if_not_collect_was_executed()
        {
            CollectFactory collectFactory = new CollectFactory(provider.GetSession());
            ProbeResult probeResult = probeResultFactory.CreateProbeResultForRegostryCollectWithError();

            ExecutionLogBuilder executionLog = new ExecutionLogBuilder();
            executionLog.StartCollectOf("registry");
            executionLog.TryConnectToHost("176.16.3.22");
            executionLog.AnErrorOccurred("Error connecting to host");
            executionLog.EndCollect();

            ProbeExecution probeExecution = collectFactory.CreateAProbeExecutionWithError("registry", executionLog.BuildExecutionLogs());
            Assert.IsNotNull(probeExecution);
            Assert.AreEqual("registry", probeExecution.Capability);
            Assert.IsTrue(probeExecution.ExecutionLogs.Count == 4, "the probe execution not have executionLogs expecteds");
            Assert.IsTrue(probeExecution.HasErrors(), "the probe execution not have a status expected");
        }