Esempio n. 1
0
        public void op_GetVirtualPath_RequestContext_RouteValueDictionary_whenInvalidDate()
        {
            var request = new Mock <HttpRequestBase>(MockBehavior.Strict);

            request
            .SetupGet(x => x.Path)
            .Returns("/1999-02-30")
            .Verifiable();

            var context = new Mock <HttpContextBase>(MockBehavior.Strict);

            context
            .SetupGet(x => x.Request)
            .Returns(request.Object)
            .Verifiable();

            var route = new DateRoute <DummyController>(string.Empty, "Representation");

            var actual = route.GetVirtualPath(
                new RequestContext(context.Object, new RouteData()),
                new RouteValueDictionary());

            Assert.Null(actual);

            request.VerifyAll();
        }
Esempio n. 2
0
        public void op_GetVirtualPath_RequestContextNull_RouteValueDictionary()
        {
            var route = new DateRoute <DummyController>(string.Empty, "Representation");

            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => route.GetVirtualPath(null, new RouteValueDictionary()));

            // ReSharper restore AssignNullToNotNullAttribute
        }