CardShop.Controllers.RuleController.Index C# (CSharp) Метод

Index() публичный Метод

public Index ( ) : System.Web.Mvc.ActionResult
Результат System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            return View(ruleService.GetAllRulesets());
        }

Usage Example

Пример #1
0
        public void TestIndexGetAllRuleSets()
        {
            mockRuleService.Setup(rules => rules.GetAllRulesets())
                .Returns(mockRuleSets).Verifiable();

            testController = new RuleController(mockRuleService.Object);
            ViewResult result = testController.Index() as ViewResult;
            List<RuleSet> ruleSets = (List<RuleSet>)result.ViewData.Model;

            Assert.IsNotNull(ruleSets, "The rules weren't returned.");
            Assert.AreEqual(TESTIDONE, ruleSets[0].RuleSetId);
            mockRuleService.Verify();
        }