public void RedirectSetting_ShouldRedirectWithRightParametersForCommandTwoWhereWeGoToDiamondSearch()
        {
            //Arrange
            var controller = CreateDefaultJewelDesignController();

            var redirectSettingModel = new RedirectSettingModel()
            {
                DiamondID = Tests.FAKE_DIAMOND_REPOSITORY_FIRST_ITEM_ID,
                MediaType = JewelMediaType.YellowGold,
                CommandID = 2,
                SettingID = Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID,
                Size = "8"

            };

            //Act
            var result = controller.RedirectSetting(redirectSettingModel);
            //Assert
            result.AssertActionRedirect()
                .WithParameter("DiamondID", 0);

            result.AssertActionRedirect()
               .WithParameter("SettingID", redirectSettingModel.SettingID);

            result.AssertActionRedirect()
               .WithParameter("Size", redirectSettingModel.Size);

            result.AssertActionRedirect()
               .WithParameter("MediaType", redirectSettingModel.MediaType);
        }
        public ActionResult RedirectSetting(RedirectSettingModel redirectSettingModel)
        {
            switch (redirectSettingModel.CommandID)
            {
                case 1:

                    return RedirectToRoute("End", new RouteValueDictionary()
                                                           {
                                                               {"SettingID", redirectSettingModel.SettingID},
                                                               {"DiamondID", redirectSettingModel.DiamondID},
                                                               {"Size", redirectSettingModel.Size},
                                                               {"MediaType", redirectSettingModel.MediaType}
                                                           });

                case 2:

                    return RedirectToRoute("DiamondSearch", new RouteValueDictionary()
                                                           {
                                                               {"SettingID", redirectSettingModel.SettingID},
                                                               {"DiamondID", 0},
                                                               {"Size", redirectSettingModel.Size},
                                                               {"MediaType", redirectSettingModel.MediaType},

                                                           });

                case 3:

                        return RedirectToAction("ShoppingCartAddJewel","Checkout", new RouteValueDictionary()
                                                           {
                                                               {"id", redirectSettingModel.SettingID},
                                                               {"size", redirectSettingModel.Size},
                                                               {"MediaType", redirectSettingModel.MediaType}
                                                           });

                default:
                    throw new Exception("When asked to redirect from jewel design setting page an invalid commandid was given:" + redirectSettingModel.CommandID);
            }
        }
        public void RedirectSetting_ShouldRedirectWithRightParametersForCommandThreeWhereWeGoToShoppingCart()
        {
            //Arrange
            var controller = CreateDefaultJewelDesignController();

            var redirectSettingModel = new RedirectSettingModel()
            {
                DiamondID = Tests.FAKE_DIAMOND_REPOSITORY_FIRST_ITEM_ID,
                MediaType = JewelMediaType.YellowGold,
                CommandID = 3,
                SettingID = Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID,
                Size = "8"

            };

            //Act
            var result = controller.RedirectSetting(redirectSettingModel);
            //Assert
            result.AssertActionRedirect().ToController("Checkout").ToAction("ShoppingCartAddJewel");

            result.AssertActionRedirect()
               .WithParameter("id", redirectSettingModel.SettingID);

            result.AssertActionRedirect()
               .WithParameter("size", redirectSettingModel.Size);

            result.AssertActionRedirect()
               .WithParameter("MediaType", redirectSettingModel.MediaType);
        }