how to test Controller
qqqzhch opened this issue · comments
webfans commented
public class HomeController : Controller
{
public DataRepository.IO.Iquestion QuestionRY { get; set; }
public DataRepository.IO.Iuserinfo UserinfoRY { get; set; }
public DataRepository.IO.Itag TagRY { get; set; }
public ActionResult Index()
{
ViewBag.Message = "欢迎使用 ASP.NET MVC!";
homeindex test = new homeindex(QuestionRY,UserinfoRY,TagRY);
var T1 = test.GetHomequestion(1, 30);
var T2 = test.SetQuestionForList(T1);
return View();
}
public ActionResult About()
{
return View();
}
}
and the Iquestion Iuserinfo Itag is Installed by
public class DataRepositoriesInstaller : IWindsorInstaller
{
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.Register(
Component.For<DataRepository.IO.Iquestion>()
.ImplementedBy<DataRepository.DO.questionR>()
.LifestyleSingleton()
);
container.Register(
Component.For<DataRepository.IO.Ianswer>()
.ImplementedBy<DataRepository.DO.answerR>()
.LifestyleSingleton()
);
container.Register(
Component.For<DataRepository.IO.Iquestiontag>()
.ImplementedBy<DataRepository.DO.questiontagR>()
.LifestyleSingleton()
);
container.Register(
Component.For<DataRepository.IO.Itag>()
.ImplementedBy<DataRepository.DO.tagR>()
.LifestyleSingleton()
);
container.Register(
Component.For<DataRepository.IO.Iurlinfo>()
.ImplementedBy<DataRepository.DO.urlinfoR>()
.LifestyleSingleton()
);
container.Register(
Component.For<DataRepository.IO.Iuserinfo>()
.ImplementedBy<DataRepository.DO.userinfoR>()
.LifestyleSingleton()
);
}
}
i whant to test Index()
so how to do it