0

I have an unusual question. I need help in understanding an original poster's own answer to his 6-month-old query on the MSDN forums.

The OP was told to ask further questions on StackOverflow, so there's no point in asking the OP to clarify his answer. I would be grateful for some help on this forum. I hope I'm not violating any forum rules or etiquette rules.

I'll just copy and paste the relevant snippets from the posts, in chronological order.


[OP] I'm following the Unit Testing with Microsoft Moles Tutorial (http://research.microsoft.com/en-us/projects/pex/molestutorial.pdf) and getting stuck with step #5 in Task 2: Create Code Generated Stubs. I cannot resolve SIFileSystem (compilation error as it cannot be found).


[OP] I finally made the program to compile. But in case anybody else stumbled with this post and have the same problem, here's what I did: - In StubsTutorialTest project, open mscorlib.moles - Change the assembly name from "mscorlib" to "StubsTutorial" - Rename mscorlib.moles to StubsTutorial.moles - Build (this will add StubsTutorial.Moles in the references) - Add "using StubsTutorial.Moles" in UnitTest.cs The not found error in "var fs = new SIFileSystem();" is gone.


[MSDN moderator] Next time you run into problems, Peli and the rest of the Pex and Moles Development team now tend to monitor the forums at Stack:

https://stackoverflow.com/questions/tagged/pex-and-moles

[Back to me]

So here are my questions:

  1. In StubsTutorialTest project, open mscorlib.moles

    mscorlib.moles in never mentioned in the tutorial. Anyway, how can someone open a DLL?

    (There's actually a "mscorlib.moles.dll" in the Moles download.)

  2. Change the assembly name from "mscorlib" to "StubsTutorial"

    In my "StubsTutorial.csproj", there's no mention of "mscorlib". I have the line:

    StubsTutorial

  3. Rename mscorlib.moles to StubsTutorial.moles

    Does he mean that I should add "mscorlib.Moles" as a reference, then rename it? Is that possible?

Thanks for any help.

Community
  • 1
  • 1
OldGrantonian
  • 597
  • 1
  • 8
  • 23

1 Answers1

0

I believe what OP did was manually create a .moles file for the Tutorial assembly, by modifying the content and name of the mscorlib.moles file. The problem is that OP did not perform Task 2 Step 1:

  1. In Visual Studio, open the test project StubsTutorialTest, open the References node, right-click the StubsTutorial reference node and select Add Moles Assembly.

This is the easy way to create a .moles file.

Mike Christian
  • 1,526
  • 1
  • 15
  • 27
  • Thanks for the response. Although I didn't mention it in this post, I use Visual Studio Express, so the " Add Moles Assembly" option (and all the subsequent automated operations) is not possible. I'm trying to do the same things manually. – OldGrantonian Apr 02 '12 at 07:45
  • I figured that is what you were doing, from your other posts. – Mike Christian Apr 04 '12 at 21:06