interface ITaxi
{
int Fare { get; set; }
int getTotalFare();
}
class Taxi : Car, ITaxi
{
public Taxi(Engine e) : base (e){ }
public int Fare { get; set; }
public int getTotalFare()
{
return 0;
}
}
[TestFixture]
class TestTaxi
{
[Test]
public void TestTaxiFare()
{
MockRepository mockRepo = new MockRepository();
ITaxi taxi = mockRepo.Stub<ITaxi>();
using (mockRepo.Record())
{
SetupResult.For(taxi.getTotalFare()).Return(400);
}
Assert.AreEqual(400, taxi.getTotalFare());
}
}
i'm new to Test Driven Development. i tried to mock a class and setuo a value for the method. but i
message castle.dynamicProxy.generators.generatorexception Type is not public, so a proxy cannot be generated. type: UnitTest.ITaxi
did i miss anything in code?
what's difference between stub and mock? [i read links didn't understand]?