Esempio n. 1
0
        public void Indeed()
        {
            var container = CompositionRoot.Get();

            var host = (IDiagnosticsHost)container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
            var misconfigurations = host.GetDiagnostic <IPotentiallyMisconfiguredComponentsDiagnostic>().Inspect();

            if (misconfigurations.Any())
            {
                var diagnosticOutput = new StringBuilder();

                foreach (IExposeDependencyInfo problem in misconfigurations)
                {
                    problem.ObtainDependencyDetails(new DependencyInspector(diagnosticOutput));
                }

                Assert.Fail(diagnosticOutput.ToString());
            }
        }
Esempio n. 2
0
        public void Indeed()
        {
            var container = CompositionRoot.Get();

            var host     = (IDiagnosticsHost)container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
            var locators = host.GetDiagnostic <IUsingContainerAsServiceLocatorDiagnostic>().Inspect();

            if (locators.Any())
            {
                var diagnosticOutput = new StringBuilder();

                diagnosticOutput.AppendLine("Following components looks suspiciously like a service locator:" + Environment.NewLine);
                foreach (var locator in locators)
                {
                    diagnosticOutput.AppendLine(locator.ToString());
                }

                Assert.Fail(diagnosticOutput.ToString());
            }
        }
 public void Indeed(Type t)
 {
     CompositionRoot.Get().Resolve(t);
 }