コード例 #1
0
        public void TestGetListEx()
        {
            var collection = new NameValueCollection
            {
                { "txtArticleTitle", "abc" },
                { "txtDate", "" },
                { "txtSubCate", "" }
            };

            var httpContext = controllerContext.HttpContext as FakeHttpContext;

            if (httpContext != null)
            {
                httpContext.SetRequest(new MockHttpRequest(collection));
            }

            controllerContext.HttpContext = httpContext;

            var artController = new ArticleInfoController(new StubArticleInfoService())
            {
                ControllerContext = controllerContext
            };

            MockData((StubArticleInfoService)artController._BaseService);

            var list = artController.GetListEx(x => x.Id == 1, new PageCondition());

            Assert.IsTrue(1 == list.Count);
        }
コード例 #2
0
        public void EditAction()
        {
            using (ShimsContext.Create())
            {
                stubArticleInfoService = new StubArticleInfoService();
                shimArticleInfoService = new ShimArticleInfoService(stubArticleInfoService);
                repository             = new StubRepository <ArticleInfo, int>(new MockContent());
                shimRepository         = new ShimRepository <ArticleInfo, int>(repository);
                InitService();

                shimArticleInfoService.Bind(repository);

                controller = new ArticleInfoController(shimArticleInfoService.Instance, 6)
                {
                    ControllerContext = controllerContext
                };

                controller.Edit("1");
            }

            //Assert.IsTrue(1 == 1);
        }