dimanche 21 juin 2020

Reference Assemblies not loaded from an integration test project dynamically in .Net Core 3.1

I create an integration test project that has a reference to a Rest API project. On the startup of my Api I do some reflection to load some classes I have on other assemblies, but I am not specifying the path of the assembly, I simply add them as a reference on my project and load them on this way

var assemblies = Assembly.GetEntryAssembly()?.GetReferencedAssemblies().Select(Assembly.Load);

When I am running my integration test project, it has a reference to my Rest API project, but it will not load into memory all the references that my Rest Api project has because the main thread is running now from my test project instead of my Rest API. I tried to add a reference to each of the projects into my Integration Test project with the hope that GetReferencedAssemblies was going to include some of them. Also, I tried to client dummy objects inside of my Integration Test Project to have an explicit reference to some of the classes of those assemblies, but when I execute the previous line, I am not getting any of the referenced assemblies(projects)

Any idea of how can I solve this issue?





Aucun commentaire:

Enregistrer un commentaire