简体   繁体   中英

References in same solution in .NET and Visual Studio

I need you guys to finally arrange this issue well in my head.

As an example, my solution contains two projects:

Project 1 has a reference to the Moq class library.

Project 2 (which is a unit test project) has a reference to Project 1.

Both needs to utilize Moq classes directly.

Does Project 2 need to have a reference to the Moq class library as well?

What if Project 1 has a static method MethodX which utilize a Moq method and returns a non Moq class library based type, and Project 2 needs to run MethodX? Should Project 2 still need a reference to the Moq class library?

Thanks,

Mikey

Project 2 needs reference to the Moq library only if this projects have direct access to objects declared in library through Project 1.

Otherwise, if Project 1 isolates Moq's classes, types, structs and uses them for internal purposes only - the reference is not needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM