コード例 #1
0
        public void MakeUrl_MissingHttpRequestBase_ThrowsArgumentNullException()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => ViewAllPath.MakeUrl(null)
                );

            Assert.Equal <string>(ViewAllPath.REQUEST_NULL, exception.ParamName);
        }
コード例 #2
0
        public void MakeUrl_TrailingSlashAndNoControllerName_ReturnsBasePathPlusSegment()
        {
            var appPath = "/";
            var mock    = new Moq.Mock <HttpRequestBase>();

            mock.Setup(x => x.ApplicationPath).Returns(appPath);

            Assert.Equal(
                string.Format("/{0}", ViewAllPath.SEGMENT),
                ViewAllPath.MakeUrl(mock.Object)
                );
        }
コード例 #3
0
        public void MakeUrl_NoTrailingSlashAndControllerName_ReturnsBasePathControllerNameSegment()
        {
            var appPath = "/virtualDirectory";
            var mock    = new Moq.Mock <HttpRequestBase>();

            mock.Setup(x => x.ApplicationPath).Returns(appPath);
            var name = "controllerName";

            Assert.Equal(
                string.Format("{0}/{1}/{2}", appPath, name, ViewAllPath.SEGMENT),
                ViewAllPath.MakeUrl(mock.Object, name)
                );
        }