Пример #1
0
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
        }
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
Пример #3
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.AreEqual("Welcome to ASP.NET MVC!", result.ViewBag.Message);
        }
Пример #4
0
        public void Index( )
        {
            // Arrange
            HomeController controller = new HomeController( );

            // Act
            ViewResult result = controller.Index( ) as ViewResult;

            // Assert
            Assert.AreEqual( "Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message );
        }
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
        }
Пример #6
0
        protected void Application_Error()
        {
            var exception = Server.GetLastError();

            Server.ClearError();

            var routeData = new RouteData();

            routeData.Values.Add("controller", "Home");
            routeData.Values.Add("action", "Error");

            IController errorController = new Controllers.HomeController();

            errorController.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));
        }
Пример #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Main);
            _controller = HelloWorld.App.Controller<HomeController>(this);
            _state = _controller.Hello().Model.As<IndexViewModel>();

            Button button = FindViewById<Button> (Resource.Id.myButton);
            button.Click += delegate {
                button.Text = string.Format ("{0} clicks!", _state.Count++);
            };

            var notes = FindViewById<Button> (Resource.Id.buttonToNotes);
            notes.Click += delegate {
                HelloWorld.App.Activiate(_controller.Notes());
            };

            var cats = FindViewById<Button> (Resource.Id.catsButton);
            cats.Click += delegate {
                HelloWorld.App.Activiate(_controller.Cats());
            };
        }
 protected void init()
 {
     _model = (IndexViewModel) ViewData.State;
     _controller = (HomeController) ViewData.Controller;
 }
Пример #9
0
 public void Up()
 {
     this.controller = new HomeController();
 }