public void ShouldCreateItem()
        {
            // arrange
            var itemId     = ID.NewID;
            var templateId = ID.NewID;

            var item        = ItemHelper.CreateInstance(this.database);
            var destination = ItemHelper.CreateInstance(this.database);

            this.dataStorage.GetSitecoreItem(itemId).Returns(item);

            var command = new OpenCreateItemCommand()
            {
                Engine = new DataEngine(this.database)
            };

            command.Initialize(itemId, "home", templateId, destination);
            command.Initialize(this.dataStorage);

            // act
            var result = command.DoExecute();

            // assert
            result.Should().Be(item);
            this.dataStorage.Received().Create("home", itemId, templateId, destination);
        }
    public void ShouldCreateItem()
    {
      // arrange
      var itemId = ID.NewID;
      var templateId = ID.NewID;

      var item = ItemHelper.CreateInstance(this.database);
      var destination = ItemHelper.CreateInstance(this.database);

      this.dataStorage.GetSitecoreItem(itemId).Returns(item);

      var command = new OpenCreateItemCommand { Engine = new DataEngine(this.database) };
      command.Initialize(itemId, "home", templateId, destination);
      command.Initialize(this.dataStorage);

      // act
      var result = command.DoExecute();

      // assert
      result.Should().Be(item);
      this.dataStorage.Received().AddFakeItem(Arg.Is<DbItem>(i => i.Name == "home" &&
                                                                  i.ID == itemId &&
                                                                  i.TemplateID == templateId &&
                                                                  i.ParentID == destination.ID));
    }
        public void ShouldCreateItem()
        {
            // arrange
            var itemId     = ID.NewID;
            var templateId = ID.NewID;

            var item        = ItemHelper.CreateInstance(this.database);
            var destination = ItemHelper.CreateInstance(this.database);

            this.dataStorage.GetSitecoreItem(itemId).Returns(item);

            var command = new OpenCreateItemCommand {
                Engine = new DataEngine(this.database)
            };

            command.Initialize(itemId, "home", templateId, destination);
            command.Initialize(this.dataStorage);

            // act
            var result = command.DoExecute();

            // assert
            result.Should().Be(item);
            this.dataStorage.Received().AddFakeItem(Arg.Is <DbItem>(i => i.Name == "home" &&
                                                                    i.ID == itemId &&
                                                                    i.TemplateID == templateId &&
                                                                    i.ParentID == destination.ID));
        }
    public void ShouldCreateItem()
    {
      // arrange
      var itemId = ID.NewID;
      var templateId = ID.NewID;

      var item = ItemHelper.CreateInstance(this.database);
      var destination = ItemHelper.CreateInstance(this.database);

      var itemCreator = Substitute.For<ItemCreator>(this.dataStorage);
      itemCreator.Create("home", itemId, templateId, database, destination).Returns(item);

      var command = new OpenCreateItemCommand { Engine = new DataEngine(this.database), ItemCreator = itemCreator };
      command.Initialize(itemId, "home", templateId, destination);
      command.Initialize(this.innerCommand);

      // act
      var result = command.DoExecute();

      // assert
      result.Should().Be(item);
    }