public void WhenInstantiatingClassWithDefaultConstructor_Succeeds() { // Arrange UrlRouteViewModel model; // Act model = new UrlRouteViewModel(); // Assert Assert.NotNull(model); }
/// <summary> /// The url route view model bind. /// </summary> /// <param name="lookFor"> /// The look for. /// </param> /// <returns> /// the url route view model /// </returns> public UrlRouteViewModel UrlRouteViewModelBind(string lookFor) { UrlRouteViewModel viewModel = null; SeoDecorator seo = this.seoDecoratorService.GetByLookFor(lookFor); IEnumerable<SeoRouteValue> routeValues = null; Page page = null; if (seo != null) { page = this.pageService.GetById(seo.PageId); routeValues = this.seoRouteValueService.GetMany(rv => rv.SeoDecoratorId == seo.SeoDecoratorId); } if (page != null) { viewModel = new UrlRouteViewModel { PageId = page.PageId, ActionName = page.ActionName, ControllerName = page.ControllerName, PortalId = page.PortalId, Title = page.Title, LookFor = seo.LookFor }; if (routeValues != null) { foreach (SeoRouteValue seoRouteValue in routeValues) { viewModel.RouteValues.Add(seoRouteValue.Key, seoRouteValue.Value); } } } return viewModel; }