AddItem() public method

public AddItem ( IExplorerItem itemToAdd, System.Guid workSpaceId ) : IExplorerRepositoryResult
itemToAdd IExplorerItem
workSpaceId System.Guid
return IExplorerRepositoryResult
        public void WhenICreateTheFolder(string folderName)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            var repository = new ServerExplorerClientProxy(environmentModel.Connection);

            Assert.AreEqual(0, repository.Load(Guid.Empty).Children.Count(a => a.DisplayName == folderName));

            var result = repository.AddItem(new ServerExplorerItem(folderName, Guid.NewGuid(), ResourceType.Folder, null, Permissions.Administrator, ""), Guid.Empty);
            Assert.AreEqual(result.Status, ExecStatus.Success);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("explorerItemModel", explorerItemModel);
            ScenarioContext.Current.Add("folderName", folderName);
        }
        public void ClientExplorerRepository_CreateFolder_ExpectCreateServiceCalled()
        {
            //------------Setup for test--------------------------
            var env = new Mock<IEnvironmentConnection>();
            var comFactory = new Mock<ICommunicationControllerFactory>();
            var rep = new ServerExplorerClientProxy(env.Object, comFactory.Object);
            var com = new Mock<ICommunicationController>();
            var item = new ServerExplorerItem("", Guid.Empty, ResourceType.DbService, null, Permissions.Contribute, "f");
            comFactory.Setup(a => a.CreateController("AddFolderService")).Returns(com.Object).Verifiable();
            com.Setup(a => a.ExecuteCommand<IExplorerItem>(env.Object, Guid.Empty)).Returns(item).Verifiable();

            //------------Execute Test---------------------------
            rep.AddItem(item, Guid.Empty);
            //------------Assert Results-------------------------

            comFactory.Verify(a => a.CreateController("AddFolderService"));
            com.Verify(a => a.ExecuteCommand<IExplorerRepositoryResult>(env.Object, Guid.Empty));
            com.Verify(a => a.AddPayloadArgument("itemToAdd", It.IsAny<string>()));
            com.Verify(a => a.ExecuteCommand<IExplorerRepositoryResult>(env.Object, Guid.Empty));
        }