Search code examples
templatestddnunitrhino-mocks

Which assembly do I need to reference to have IDependency interface available


I am trying to run a NUnit/Rhinomock template for VS2010 and the code contains the following

IDependency dependency = mocks.CreateMock<IDependency>();

        // Record expectations
        using (mocks.Record())
        {
            Expect.Call(dependency.Method1("parameter")).Return("result");
            dependency.Method2();
        }

        // Replay and validate interaction
        Subject subjectUnderTest;
        using (mocks.Playback())
        {
            subjectUnderTest = new Subject(dependency);
            subjectUnderTest.DoWork();
        }

        // Post-interaction assertion
        Assert.That(subjectUnderTest.WorkDone, Is.True);   

Which assemblies do I need to add to make this compile the

IDependency and Subject classes are not found

PS I am new to TDD


Solution

  • I'm assuming that you got this code snippet as an example from some source.

    IDependency and Subject seem to be placeholders for whatever you want to test.

    e.g. Let's say you want to test your class Driver without having to create a dependency - his Car. So you use a test like the one above to mock out the Car (IDependency) so that you can test the Driver (Subject) in isolation. To get this to compile, your test DLL needs to reference the assembly where Car and Driver types are defined.. i.e. your production code.