public void Index_Post_CallMove_After_Calling_Place()
        {
            // Arrange
            WebRemoteController controller = new WebRemoteController(new SessionStorage());
            ViewResult result = controller.Index(new WebViewModel { Command = "Place,0,0,North" }) as ViewResult;

            result = controller.Index(new WebViewModel { Command = "Move" }) as ViewResult;
            Assert.IsNotNull(result.Model);
            var model = result.Model as WebViewModel;

            Assert.IsNull(model.ErrorMessage);
            Assert.IsNotNull(model.Grid);
        }
        public void Index_Post_CallLeft_After_Initial_North()
        {
            // Arrange
            WebRemoteController controller = new WebRemoteController(new SessionStorage());
            ViewResult result = controller.Index(new WebViewModel { Command = "Place,0,0,North" }) as ViewResult;

            result = controller.Index(new WebViewModel { Command = "Left" }) as ViewResult;
            Assert.IsNotNull(result.Model);
            var model = result.Model as WebViewModel;

            Assert.IsNull(model.ErrorMessage);
            Assert.IsNotNull(model.Grid);
            Assert.IsTrue(model.Grid.Contains('W'));
        }
        public void Index_Get()
        {
            // Arrange
            WebRemoteController controller = new WebRemoteController(new SessionStorage());

            // Act
            ViewResult result = controller.Index() as ViewResult;
               // Assert
            Assert.IsNotNull(result.Model);
            Assert.IsTrue(result.Model.GetType().Name.Equals("WebViewModel"));
            var model = (WebViewModel)result.Model;
            Assert.IsTrue(model.Grid.StartsWith("<table"));
        }
 public void Index_Post_InvalidPlaceCmd_Format()
 {
     // Arrange
     WebRemoteController controller = new WebRemoteController(new SessionStorage());
     ViewResult result = controller.Index(new WebViewModel { Command = "Place2,1" }) as ViewResult;
     Assert.IsNotNull(result.Model);
     var model = result.Model as WebViewModel;
     Assert.IsNotNull(model.ErrorMessage);
 }