I have this class called Table:
class Table
{
public string Name
{
get
{
return this.wrapper.Eval(//some command);
//wrapper is pass in by the ctor and is a COM object.
}
}
}
which is used in this class:
class Map
{
public Map MapTable(Table table)
{
return new Map(table.Name);
}
}
I want to test MapTable command, should I be mocking Table or should I mock the wrapper object that is used by the table object.
I was thinking something like this
Test()
{
Mock<ITable> mocktable = new Mock<ITable>(//pass in the wrapper object);
mocktable.ExpectGet(n => n.Name).Returns("Hello World");
ITable table = mocktable.object;
Map mymap = Map.MapTable(table);
}
Would that be correct?