Esempio n. 1
0
        /// <summary>
        /// Adds <see cref="DataTypeDefinition"/> to Runtime.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>TestingAssembly.</returns>
        public TestingAssembly AddToRuntime <T>()
            where T : DataTypeDefinition
        {
            beforeRuntimeAction(() =>
            {
                var runtimeTypeDef = Activator.CreateInstance <T>();
                Runtime.AddDefinition(runtimeTypeDef);
            });

            return(this);
        }
Esempio n. 2
0
        public void Compose_PrerequisityImport_LoadedAssembly()
        {
            var testAssembly = new RuntimeAssembly("test.exe");

            testAssembly.AddDefinition(new StringExport2());

            AssemblyUtils.Run(@"        
                var partExport=new StringExport(""PastedExport"");       
                var partImport=new ICollectionStringImport();
                
                var test=new CompositionTester(""test.exe"");   
                test.Add(partExport);
                test.Add(partImport);
                test.Compose();
                
                var import=partImport.Import;
                var result1=import[0];
                var result2=import[1];          
            ")

            .AddToRuntime <CompositionTesterDefinition>()
            .AddToRuntime <StringExport>()
            .AddToRuntime <ICollectionStringImport>()
            .AddDirectToRuntime <List <string> >()
            .AddDirectToRuntime <ICollection <string> >()
            .AddAssembly(testAssembly)

            //export from pasted export
            .AssertVariable("result2").HasValue("Data:PastedExport")

            //export from referenced assembly, filled with pasted export via prerequisity import
            .AssertVariable("result1").HasValue("Data2:DefaultExport")

            ;
        }
Esempio n. 3
0
 /// <summary>
 /// Exports the given <see cref="DataTypeDefinition"/> to <see cref="RuntimeAssembly"/>.
 /// </summary>
 /// <param name="definition">The data type definition.</param>
 protected void ExportDefinition(DataTypeDefinition definition)
 {
     Message("Exporting {0} for data type {1}", definition, definition.FullName);
     _currentRuntime.AddDefinition(definition);
 }