c# - Unit testing of dynamically created assembly -


i've asked similar question in past , put thing aside , , got problem. try achieve run unit tests on dynamically created dll.

we have api qa engineers insert scripts our application. qa enginner , writes code in our application editor , , code compiled in runtime , , saved assembly on disk.

we able run set of tests on dynamically created assembly. forcing our qa team inherit base class , override methods , , these methods want test...

how impliment ? idea helpful. thanks.

you'll have inspect types in dynamic assembly , find concrate types derive base class. assuming have parameterless constructors, can like:

assembly dynamicassembly = //generated var derivedinstances = dynamicassembly.gettypes()     .where(t => !t.isabstract && t.issubclassof(typeof(baseclass)))     .select(t => (baseclass)activator.createinstance(t));  foreach(baseclass bc in derivedinstances) {     //run tests } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -