Exemple #1
0
        public void LocationsConverterReturnsNullForNullSourceMember()
        {
            // Arrange
            var converter = new LocationsConverter();
            ContentPageModel?sourceMember = null;
            var context = new ResolutionContext(null, null);

            // Act
            var result = converter.Convert(sourceMember, context);

            // Assert
            Assert.Null(result);
        }
Exemple #2
0
        public void LocationsConverterReturnsPathForNoCanonicalName()
        {
            // Arrange
            var expectedResult = new List <string> {
                "/hello"
            };
            var converter    = new LocationsConverter();
            var sourceMember = new ContentPageModel {
                PageLocation = "/hello", CanonicalName = string.Empty
            };
            var context = new ResolutionContext(null, null);

            // Act
            var result = converter.Convert(sourceMember, context);

            // Assert
            Assert.Equal(expectedResult, result);
        }
Exemple #3
0
        public void LocationsConverterReturnsPathForDefaultRootPageLocation()
        {
            // Arrange
            var expectedResult = new List <string> {
                "/", "/home"
            };
            var converter    = new LocationsConverter();
            var sourceMember = new ContentPageModel {
                PageLocation = "/", CanonicalName = "home", IsDefaultForPageLocation = true
            };
            var context = new ResolutionContext(null, null);

            // Act
            var result = converter.Convert(sourceMember, context);

            // Assert
            Assert.Equal(expectedResult, result);
        }
Exemple #4
0
        public void LocationsConverterReturnsPathWithRedirectLocations()
        {
            // Arrange
            var expectedResult = new List <string> {
                "/hello/world", "/hello/cruel/world", "/hello/big/wide/world"
            };
            var converter    = new LocationsConverter();
            var sourceMember = new ContentPageModel {
                PageLocation = "/hello", CanonicalName = "world", RedirectLocations = new List <string> {
                    "/hello/cruel/world", "/hello/big/wide/world"
                }
            };
            var context = new ResolutionContext(null, null);

            // Act
            var result = converter.Convert(sourceMember, context);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public LocationConverterTests()
        {
            var loggerMock = new Mock <ILogger <LocationsConverter> >();

            this.sut = new LocationsConverter(loggerMock.Object);
        }