Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to test Controller #6

Open
qqqzhch opened this issue Dec 15, 2013 · 0 comments
Open

how to test Controller #6

qqqzhch opened this issue Dec 15, 2013 · 0 comments

Comments

@qqqzhch
Copy link

qqqzhch commented Dec 15, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant