コード例 #1
0
        public void GetSlugFromRequest_WithoutSlugInRouteData_ReturnsNull()
        {
            // arrange
            var routeData = new RouteData();
            var requestContext = new RequestContext(new Mock<HttpContextBase>().Object, routeData);

            // act
            string slug = requestContext.GetSlugFromRequest();

            // assert
            Assert.IsNull(slug);
        }
コード例 #2
0
        public void GetSlugFromRequest_WithSlugInRouteData_ReturnsSlug()
        {
            // arrange
            var routeData = new RouteData();
            routeData.Values.Add("slug", "my-category");
            var requestContext = new RequestContext(new Mock<HttpContextBase>().Object, routeData);

            // act
            string slug = requestContext.GetSlugFromRequest();

            // assert
            Assert.AreEqual("my-category", slug);
        }