Example #1
0
        public override Item GetItem(ID itemId, Language language, Version version, Database database, SecurityCheck securityCheck)
        {
            var args = new GetItemByIdArgs(this.DefaultProvider, itemId, language, version, database, securityCheck);

            CorePipeline.Run("getItemById", args);

            return(args.Result);
        }
        public void ShouldGetItemUsingDefaultProvider()
        {
            // arrange
            var defaultProvider = Substitute.For <ItemProvider>();
            var processor       = new GetItemById();

            using (var db = new Db {
                new DbItem("home")
            })
            {
                var item = db.GetItem("/sitecore/content/home");
                defaultProvider.GetItem(item.ID, item.Language, item.Version, item.Database, SecurityCheck.Enable).Returns(item);

                var args = new GetItemByIdArgs(defaultProvider, item.ID, item.Language, item.Version, item.Database, SecurityCheck.Enable);

                // act
                processor.Process(args);

                // assert
                args.Result.Should().Be(item);
            }
        }