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

public RenameItem ( IExplorerItem itemToRename, string newName, System.Guid workSpaceId ) : IExplorerRepositoryResult
itemToRename IExplorerItem
newName string
workSpaceId System.Guid
Результат IExplorerRepositoryResult
        public void ServerExplorerRepository_RenameItem_DuplicateExists_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 res = new Mock<IResource>();
            res.Setup(a => a.ResourceName).Returns("dave");
            res.Setup(a => a.ResourcePath).Returns("bob");
            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.GetResource(It.IsAny<Guid>(), guid)).Returns(res.Object);

            catalogue.Setup(a => a.RenameResource(It.IsAny<Guid>(), guid, "dave")).Returns(new ResourceCatalogResult { Message = "moo", Status = ExecStatus.AccessViolation }).Verifiable();
            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());
            catalogue.Setup(a => a.GetResourceList(It.IsAny<Guid>())).Returns(new List<IResource> { res.Object });

            //------------Execute Test---------------------------
            var result = serverExplorerRepository.RenameItem(explorerItem, "dave", Guid.NewGuid());
            //------------Assert Results-------------------------
            Assert.AreEqual("There is an item that exists with the same name and path", result.Message);
            Assert.AreEqual(result.Status, ExecStatus.Fail);

        }
        public void ServerExplorerRepository_RenameItem_VerifyNullThrowsException()
        {
            //------------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.RenameItem(null, "bob", Guid.NewGuid());
            Assert.AreEqual(res.Status, ExecStatus.Fail);
            Assert.AreEqual(res.Message, "Item to rename was null");
            // ReSharper restore ObjectCreationAsStatement

        }
        public void ServerExplorerRepository_RenameItem_AssertFolderFails_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var catalogue = new Mock<IResourceCatalog>();
            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            var explorerItem = new ServerExplorerItem(
                "d", Guid.NewGuid(),
                ResourceType.Folder,
                new List<IExplorerItem>()
                , Permissions.Administrator, "bob"
                );
            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());
            factory.Setup(a => a.CreateRootExplorerItem(It.IsAny<string>(), It.IsAny<Guid>())).Returns(explorerItem);

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