FakeItEasy mock interface not found
I'm new to FakeItEasy and mocking in general. I created a Visual Studio 2010 C# class library project. I added references to the NUnit DLL and the FakeItEasy DLL. I added "using" statements for both, then attempted to try some of the documentation examples. My code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FakeItEasy.Core;
// ...
using NUnit.Framework;
namespace TestLib
{
[TestFixture]
public class Tester
{
[Test]
public void SomeTest()
{
ISomething mockThing = A.Fake<ISomething>();
/*
开发者_如何学Python ...
*/
}
}
}
I get errors "The type or namespace name 'ISomething' could not be found" and "The name 'A' does not exist in the current context."
What am I missing?
It turns out that it is necessary to create the interfaces that are referred to in the mocks. They are not auto-generated.
It is, however possible to specify additional interfaces to be implemented:
var foo = A.Fake<IFoo>(x => x.Implements(typeof(IComparable)).Implements(typeof(IFormattable)));
精彩评论