コード例 #1
0
        public void GetCategoryBreadCrumb_ShouldReturnEmptyList()
        {
            var allCategory = GetMockCategoryList();
            var category    = new Grand.Domain.Catalog.Category()
            {
                ParentCategoryId = "3"
            };

            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <Customer>())).Returns(() => true);
            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <string>())).Returns(() => true);
            var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);

            Assert.IsTrue(result.Count == 0);
        }
コード例 #2
0
        public void GetFormattedBreadCrumb_ReturnExprectedString()
        {
            var exprectedString = "cat5 >> cat1 >> cat6";
            var allCategory     = GetMockCategoryList();
            var category        = new Grand.Domain.Catalog.Category()
            {
                Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true
            };

            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <Customer>())).Returns(() => true);
            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <string>())).Returns(() => true);
            var result = _categoryService.GetFormattedBreadCrumb(category, allCategory);

            Assert.IsTrue(exprectedString.Equals(result));
        }
コード例 #3
0
        public void GetCategoryBreadCrumb_ShouldReturnTwoElement()
        {
            var allCategory = GetMockCategoryList();
            var category    = new Grand.Domain.Catalog.Category()
            {
                Id = "6", ParentCategoryId = "3", Published = true
            };

            _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store()
            {
                Id = ""
            });
            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <Customer>())).Returns(() => true);
            _aclServiceMock.Setup(a => a.Authorize <Grand.Domain.Catalog.Category>(It.IsAny <Grand.Domain.Catalog.Category>(), It.IsAny <string>())).Returns(() => true);
            var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);

            Assert.IsTrue(result.Count == 2);
            Assert.IsTrue(result.Any(c => c.Id.Equals("6")));
            Assert.IsTrue(result.Any(c => c.Id.Equals("3")));
        }