c# - Why won't Fakes properly reference a Fakes dll from a prebuilt Fakes project? -


i have problem in trying reference mscorlib fake dll separate projects, described below.

i have numerous vs12 solutions i'm writing unit tests using ms fakes. based on suggestion in following url, i've decided make project fake dlls: code generation, compilation, , naming conventions in microsoft fakes. idea location of fake dlls localized , don't need have numerous faked dlls strewn throughout test projects. (i'll call common fakes library.)

in current unit tests, i'm using shims presentationcore, system.management , system. however, system shims i'm using in mscorlib.dll, more convert (a static class) , driveinfo (a sealed class). because need these 2 classes mscorlib (for now) i've created following .fakes file mscorlib:

<fakes xmlns="http://schemas.microsoft.com/fakes/2011/">   <assembly name="mscorlib" version="4.0.0.0"/>   <stubgeneration>     <clear/>       </stubgeneration>   <shimgeneration>     <clear/>     <add fullname="convert"/>     <add fullname="driveinfo"/>   </shimgeneration> </fakes> 

for presentationcore , systemmanagement, have similar .fakes files clear , add classes name.

however, in test project, when add reference mscorlib.4.0.0.0.fakes dll common fakes library, tests using convert , driveinfo shims don't run. instead, test method throws microsoft.qualitytools.testing.fakes.shims.shimnotsupportedexception, naming unsupported shimmed class. tests using functionality presentationcore , system.management still work when referencing common fakes library.

however, if add fakes assembly system directly (and mscorlib indirectly) in test project, create exact same mscorlib.fakes file in test project, , add references local mscorlib.4.0.0.0.fakes dll, tests threw exceptions when linked common fakes library run without glitch.

i've looked @ mscorlib faked dll in common fakes library using object browser , compared 1 built locally , appear same.

does have idea why referencing mscorlib fake in common fakes library doesn't work?

the thing fakes it's meant regenerate dlls on every build. less important system dlls, worth remembering. should keep them within project, because can't sure how linking between them goes shims.

i don't know how shims implemented, override methods @ runtime. think we'd need developer answer in more detail, issue mscorlib, has flaky support fakes (by design).

ultimately though, goal seems to save couple clicks on test projects, while risking fakes losing sync. chances of happening aren't important - not worth making tests less explicit.

the goal of tests reduce maintenance costs, hiding things less important them normal code; adds steps maintenance process. fakes arcane enough people without added strain of 'oh, it's being referenced indirectly... work?'


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -