DeleteItem() публичный Метод

public DeleteItem ( IExplorerItem itemToDelete, System.Guid workSpaceId ) : IExplorerRepositoryResult
itemToDelete IExplorerItem
workSpaceId System.Guid
Результат IExplorerRepositoryResult
        public void ServerExplorerRepository_DeleteItem_AssertItemCallCorrectMethods_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var catalogue = new Mock<IResourceCatalog>();
            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            var guid = Guid.NewGuid();

            var explorerItem = new ServerExplorerItem(
                "dave", guid,
                ResourceType.DbSource,
                new List<IExplorerItem>()
                , Permissions.Administrator, "bob"
                );
            factory.Setup(a => a.CreateRootExplorerItem(It.IsAny<string>(), It.IsAny<Guid>())).Returns(explorerItem);
            catalogue.Setup(a => a.DeleteResource(It.IsAny<Guid>(), "dave", "DbSource", null,true)).Returns(new ResourceCatalogResult { Message = "bob", Status = ExecStatus.DuplicateMatch });
            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());

            //------------Execute Test---------------------------
            var result = serverExplorerRepository.DeleteItem(explorerItem, Guid.NewGuid());
            //------------Assert Results-------------------------
            Assert.AreEqual(result.Message, "bob");
            Assert.AreEqual(result.Status, ExecStatus.DuplicateMatch);
            catalogue.Verify(a => a.DeleteResource(It.IsAny<Guid>(), "dave", "DbSource", null,true));
        }
        public void ServerExplorerRepository_DeleteItemFolder_AssertItemCallCorrectMethods_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var catalogue = new Mock<IResourceCatalog>();
            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            var guid = Guid.NewGuid();

            var explorerItem = new ServerExplorerItem(
                "dave", guid,
                ResourceType.Folder,
                new List<IExplorerItem>()
                , Permissions.Administrator, "bob"
                );
            factory.Setup(a => a.CreateRootExplorerItem(It.IsAny<string>(), It.IsAny<Guid>())).Returns(explorerItem);
            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());

            //------------Execute Test---------------------------
            var result = serverExplorerRepository.DeleteItem(explorerItem, Guid.NewGuid());
            //------------Assert Results-------------------------
            Assert.AreEqual(result.Message, "Requested folder does not exist on server. Folder: bob");
            Assert.AreEqual(result.Status, ExecStatus.Fail);

        }
        public void ServerExplorerRepository_AddItem_VerifyDeleteThrowsException()
        {
            //------------Setup for test--------------------------

            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            var catalogue = new Mock<IResourceCatalog>();
            // ReSharper disable ObjectCreationAsStatement
            var sync = new Mock<IExplorerRepositorySync>();
            var repo = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());
            var res = repo.DeleteItem(null, Guid.NewGuid());
            Assert.AreEqual(res.Status, ExecStatus.Fail);
            Assert.AreEqual(res.Message, "Item to delete was null");
            // ReSharper restore ObjectCreationAsStatement

        }