private void writeConfigurationAndValidate(DoctorReport report, PluginGraph graph)
        {
            var pipelineGraph = new PipelineGraph(graph);
            var writer        = new WhatDoIHaveWriter(pipelineGraph);

            report.WhatDoIHave = writer.GetText();

            var session = new ValidationBuildSession(pipelineGraph, graph.InterceptorLibrary);

            session.PerformValidations();

            if (session.HasBuildErrors())
            {
                report.Result = DoctorResult.BuildErrors;
            }
            else if (session.HasValidationErrors())
            {
                report.Result = DoctorResult.ValidationErrors;
            }

            if (!session.Success)
            {
                report.ErrorMessages = session.BuildErrorMessages();
            }
        }
示例#2
0
        private void writeConfigurationAndValidate(DoctorReport report, PluginGraph graph)
        {
            var pipelineGraph = new PipelineGraph(graph);
            var writer = new WhatDoIHaveWriter(pipelineGraph);
            report.WhatDoIHave = writer.GetText();

            var session = new ValidationBuildSession(pipelineGraph, graph.InterceptorLibrary);
            session.PerformValidations();

            if (session.HasBuildErrors())
            {
                report.Result = DoctorResult.BuildErrors;
            }
            else if (session.HasValidationErrors())
            {
                report.Result = DoctorResult.ValidationErrors;
            }

            if (!session.Success)
            {
                report.ErrorMessages = session.BuildErrorMessages();
            }
        }
 private BuildError getFirstAndOnlyError(ValidationBuildSession session)
 {
     Assert.AreEqual(1, session.BuildErrors.Length);
     return session.BuildErrors[0];
 }
        private ValidationBuildSession validatedSession(Action<Registry> action)
        {
            var registry = new Registry();
            action(registry);

            PluginGraph graph = registry.Build();
            var session = new ValidationBuildSession(graph);
            session.PerformValidations();

            return session;
        }
        public void Request_an_instance_for_the_second_time_successfully_and_get_the_same_object()
        {
            var session = new ValidationBuildSession(new PluginGraph());

            var instance = new ObjectInstance(new ColorWidget("Red"));
            object widget1 = session.CreateInstance(typeof (IWidget), instance);
            object widget2 = session.CreateInstance(typeof (IWidget), instance);

            Assert.AreSame(widget1, widget2);
        }