internal static void Check(Category category)
		{
			category.NiceUrl();
			var aaa1 = category.Url;
			var aaa2 = category.UrlName;
			var aaa3 = category.Images;
			var aaa4 = category.Tags;

#pragma warning disable 612,618
			Check(category.Categories.First()); // important, razors are out there that use this
#pragma warning restore 612,618
		}
Пример #2
0
		/// <summary>
		/// Returns unique categories witch have one ore more tags in common with the given category
		/// </summary>
		/// <param name="category">The category.</param>
		/// <param name="storeAlias">The store alias.</param>
		/// <returns></returns>
		public static IEnumerable<ICategory> MatchingTagCategories(Category category, string storeAlias = null)
		{
			return DomainHelper.GetAllCategories(false, storeAlias).Where(x => x.Tags.Intersect(category.Tags).Any()).ToList();
		}
		public void CategoryNiceUrl_NoStorePickerSet_ReturnsSlashCategoryUrl()
		{
			IOC.IntegrationTest();
			IOC.CategoryService.UseType<FakeCategoryService>();
			IOC.StoreService.Actual();

			IOC.CMSEntityRepository.Mock(out _cmsEntityRepositoryMock);
			_cmsEntityRepositoryMock.Setup(m => m.GetByGlobalId(1)).Returns(new UwbsNode {NodeTypeAlias = "uwbsCategory"});
			_cmsEntityRepositoryMock.Setup(m => m.GetObjectsByAliasUncached<Store>(Store.NodeAlias, It.IsAny<ILocalization>(), It.IsAny<int>())).Returns(new List<Store> { StoreHelper.GetCurrentStore() });
			Mock<ICategoryService> catalogServiceMock;
			IOC.CategoryService.Mock(out catalogServiceMock);
			var category = new Category {UrlName = "shoes", ParentId = -1, SubCategories = Enumerable.Empty<Category>()};
			catalogServiceMock.Setup(m => m.GetById(1, It.IsAny<ILocalization>(), It.IsAny<bool>())).Returns(category);
			catalogServiceMock.Setup(m => m.Localize(category, It.IsAny<ILocalization>())).Returns(category); // bah bah

			uWebshop.Domain.Core.Initialize.InitializeServiceLocators(IOC.CurrentContainer); // todo hackish, find a better solution

			Assert.AreEqual(IOC.StoreService.Resolve(), StoreHelper.StoreService);

			var actual = StoreHelper.GetNiceUrl(1);

			Assert.AreEqual("/shoes", actual);
		}
		public void UrlRenderingForSecondaryRoute()
		{
			var a = new Category();
			//a.NiceUrl()
		}