views:

13

answers:

2

Hi,

I am fairly new to development, and Visual Studio 2010.

I have a solution with a Test Project:

  • In my solution, there are two projects: "TPS" and "TPS.Tests"
  • In the TPS project, in the namespace "TPS.Models" I have defined a bunch of classes, and two interfaces.
  • I have created a Test Class in the TPS.Tests project, and have added "using TPS.Models;"
  • I attempt to implement the interface by typing it out (e.g. public class FakeObjectClass : IObjectClass), but it isn't recognised (so I can't get the auto-implement going, which would be handy as I have over 100 methods)
  • Typing in the class, in Intellisense, I can see all the objects defined in my model, but none of the interfaces.

Google has been unusually silent on the search combinations I have tried. I am hoping there is some simple explanation/fix?

Thanks in advance for your time.

Tim.

+1  A: 

If you haven't specified an access modifier when defining the Interface, it will default to internal and not be visible to other assemblies.

Make sure that you defined your interface as

public interface IMyInterface
Reed Rector
That was it...brilliant.
nulliusinverba
A: 

A few things to check: - Does your "TPS.Tests" project have a reference to the "TPS" project? - Are your interfaces in the "TPS.Models" namespace? Putting the files in a sub-directory of the project, such as "Interfaces", can affect their namespace. - Are the interfaces marked as Public?

Also, I would suggest using an Isolation (aka "Mocking" framework) to create your fake objects, such as Moq, Rhino.Mocks, etc, rather than rolling your own fake objects for most situations.

Hugo
Thanks, mate - will check it out.
nulliusinverba