public void BreadcrumbConverterReturnsNullForNoContentItems() { // Arrange var converter = new BreadcrumbConverter(); var sourceMember = new ContentPageModel(); var context = new ResolutionContext(null, null); // Act var result = converter.Convert(sourceMember, context); // Assert Assert.Null(result); }
public void BreadcrumbConverterReturnsSuccessForContentItems() { // Arrange var converter = new BreadcrumbConverter(); var sourceMember = BuildContentPageModel(); var context = new ResolutionContext(null, null); var expectedResult = new List <BreadcrumbItemViewModel> { new BreadcrumbItemViewModel { Route = "/", Title = "Home", AddHyperlink = true, }, new BreadcrumbItemViewModel { Route = "/segment-1", Title = "Segment #1", AddHyperlink = true, }, new BreadcrumbItemViewModel { Route = "/segment-1/segment-2", Title = "Segment #2", AddHyperlink = true, }, new BreadcrumbItemViewModel { Route = "/segment-1/segment-2/segment-3", Title = "Segment #3", AddHyperlink = true, }, new BreadcrumbItemViewModel { Route = "/segment-1/segment-2/segment-3/a-canonical-name", Title = "A page title", AddHyperlink = false, }, }; // Act var result = converter.Convert(sourceMember, context); // Assert Assert.Equal(expectedResult.Last().Route, result.Last().Route); }