Esempio n. 1
0
        public void MakeUrl_MissingHttpRequestBase_ThrowsArgumentNullException()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => ViewAllPath.MakeUrl(null)
                );

            Assert.Equal <string>(ViewAllPath.REQUEST_NULL, exception.ParamName);
        }
Esempio n. 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)
                );
        }
Esempio n. 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)
                );
        }
Esempio n. 4
0
 public void All_NullUri_ReturnsFalse()
 {
     Assert.False(ViewAllPath.All(null));
 }
Esempio n. 5
0
        public void All_ViewAllSegmentInUri_ReturnsTrue()
        {
            var uri = new Uri(new Uri("http://test.test"), ViewAllPath.SEGMENT);

            Assert.True(ViewAllPath.All(uri));
        }
Esempio n. 6
0
 public void All_NoViewAllSegmentInUri_ReturnsTrue()
 {
     Assert.False(ViewAllPath.All(new Uri("http://test.test")));
 }