public RedirectToRouteResult EditMenuItem(int? id, MenuItem menuItem, FormCollection form)
        {
            this.LoadEntryToCurrentMenuItem(form,
                                            menuItem);

            menuItem.NavigateUrl = menuItem.NavigateUrl.NullSafe();
            this.serviceFactory.MenuService.SaveMenuItem(menuItem);
            this.FormatResultMessage(menuItem,
                                id);

            return RedirectToAction("EditMenuItem",
                                    "AdminMenuItem",
                                    new {id = menuItem.Id});
        }
        public void FormatResultMessage_Updated()
        {
            // arrange
            var iut = new AdminMenuItemController(null);
            var item = new MenuItem
            {
                Id = 42,
            };

            // act
            iut.FormatResultMessage(item, 42);

            // assert
            var actual = iut.TempData["SaveResult"];
            Assert.AreEqual("Items was successfully updated", actual);
        }
        public void FormatResultMessage_Updated()
        {
            // arrange
            var serviceFactory = new TestServiceFactory
            {
                MenuService = new MenuServiceMole
                {
                    SaveMenuItem = i => { },
                },
            };
            var iut = new AdminMenuItemController(serviceFactory);
            var item = new MenuItem
            {
                Id = 42,
            };
            var formCollection = new FormCollection();

            // act - EditMenuItem eventually calls FormatResultMessage
            iut.EditMenuItem(42, item, formCollection);

            // assert
            var actual = iut.TempData["SaveResult"];
            Assert.AreEqual("Items was successfully updated", actual);
        }