Ejemplo n.º 1
0
        public void ConstraintNotPresent()
        {
            var languageProviderMock = new Mock <IPageService>();

            var constraint = new PageSFUrlRouteConstraint(languageProviderMock.Object);

            Assert.IsFalse(constraint.Match(null, null, null, new RouteValueDictionary(),
                                            RouteDirection.IncomingRequest));
        }
Ejemplo n.º 2
0
        public void ConstratintPresentPageFound()
        {
            var pageServiceMock = new Mock <IPageService>();

            pageServiceMock.Setup(x => x.GetPage(It.IsAny <string>()))
            .Returns(new PageViewModel());

            var constraint = new PageSFUrlRouteConstraint(pageServiceMock.Object);

            Assert.IsTrue(constraint.Match(null, null, null, new RouteValueDictionary(new Dictionary <string, string>()
            {
                { PageSFUrlRouteConstraint.ROUTE_LABEL, "page_url" }
            }),
                                           RouteDirection.IncomingRequest));
        }