Hi,
I'm using MvcContrib's test helpers and Rhino Mocks 3.5 to test an ASP.NET MVC action method. I build my fake controller like so:
var _builder = new TestControllerBuilder();
_builder.InitializeController(_controller);
So I get a fake controller that contains fake HTTP Server etc.
I'm then trying to stub the Server.MapPath method like so
controller.Server.Stub(x => x.MapPath(Arg<string>.Is.Anything)).Return("/APP_DATA/Files/");
but in my method under test the call to Server.MapPath("/APP_DATA/Files/") returns null.
This is the test
const string STOCK_NUMBER_ID = "1";
const string FULL_FILE_PATH = "App-Data/Files";
var controller = CreateStockController();
_uploadedFileTransformer.Stub(x => x.ImageBytes).Return(new byte[10]);
_uploadedFileTransformer.Stub(x => x.ConvertFileToBytes(FULL_FILE_PATH)).Return(true);
controller.Server.Stub(x => x.MapPath(Arg<string>.Is.Anything)).Return("/App_Data/Files/");
controller.AddImage(Guid.NewGuid(), STOCK_NUMBER_ID);
What I am missing?