Is it possible to run tests on an in-memory assembly?

吃可爱长大的小学妹 提交于 2021-02-10 14:25:42

问题


I am currently building a mutationtest framework for .NET. I want to run the unit tests from a project on an in-memory assembly. This way the mutated assembly won't have to be writen to disk and my framework will be faster to use.

Using the Roslyn compiler in .Net Core 2.0 I mutate (change) the syntaxtree and compile it into an in-memory assembly like this:

Assembly assembly = AssemblyLoadContext.Default.LoadFromStream(ms);

Does anyone know of a way to unit test this assembly without writing it to a disk?

The current way I am doing it is writing it to disk and invoke the dotnet test command on the directory

来源:https://stackoverflow.com/questions/48930714/is-it-possible-to-run-tests-on-an-in-memory-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!