Can we Pass Object as a input argument in the stub method.? Because I think because I am passing object as argument in stub its giving null referencer exception?
var mock1=MockRepository.GenerateStub<Iinterface1>();
var mock2=MockRepository.GenerateStub<Iinterface2>();
HomeController hc=new HomeController(mock1,mock2);
var workitem=new workmodel(){ login="TEST" };
var workitemReturn=new workmodel(){ login="TEST", id="aaaaaaaaaa" };
mock2.Stub(x=> x.StartMethod(workitem)).Return(workitemReturn);
var result=hc.Mehod2() as ViewResult;
Assert.AreEqual("View1",result.ViewName);
Aucun commentaire:
Enregistrer un commentaire