kkozmic / ToBeSeen

Extensibility sample app for Castle Windsor

Home Page:http://docs.castleproject.org/Windsor.Windsor-tutorial-ASP-NET-MVC-3-application-To-be-Seen.ashx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to test Controller

qqqzhch opened this issue · comments

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