Exemple #1
0
        public static void Main(string[] args)
        {
            ITestHarness testharness = harness.Create();

            CompositionCode code = Singleton <IExtensibilityHost, ExtensibilityHost> .Instance.SatisfyImports(testharness);

            if (code == CompositionCode.Success)
            {
                Action <string>             output = text => Console.WriteLine(text);
                Func <string, bool, string> format = (text, result) => String.Format(text, result);

                output.Invoke("getting the testcases");

                output.Invoke("composed");

                RunSelectedTests(testharness.SyncTests, testharness.AsyncTests, TestsToRun);
            }


            Singleton <IExtensibilityHost, ExtensibilityHost> .Instance.Dispose();
        }
Exemple #2
0
        public CompositionCode SatisfyImports(object o)
        {
            if (this.sequence != Sequence.Initial)
            {
                throw new Exception("Composition sequence is incorrect");
            }
            CompositionCode result = CompositionCode.Success;

            this.sequence = Sequence.Compose;
            this.init();
            try {
                this._container.SatisfyImportsOnce(o);
            } catch (CompositionException ex) {
                result = CompositionCode.Unknown_Error;
                // no way to determine actual error from the ex object.
                // possible errors are:
                //    More than one export was found that matches the constraint
                //    No exports were found that match the constraint
            }
            this.sequence = Sequence.SatisfyImports;
            return(result);
        }