RenameItem() public method

public RenameItem ( IExplorerItemModel item, string newName ) : void
item IExplorerItemModel
newName string
return void
 public void StudioResourceRepository_RenameItem_ExplorerItemModelIsNull_ThrowsException()
 {
     //------------Setup for test--------------------------
     var repository = new StudioResourceRepository(null, Guid.Empty, _invoke);
     //------------Execute Test---------------------------
     repository.RenameItem(null, "New Name");
 }
        public void StudioResourceRepository_RenameItem_ServiceThrowsAnException_ReThrowsAndException()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            mockExplorerResourceRepository.Setup(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()))
                                          .Throws(new Exception("Something really bad happened, reboot your PC or risk a Harddrive crash"));

            var environmentId = Guid.NewGuid();
            var workflowId = Guid.NewGuid();
            SetupEnvironmentRepo(environmentId);
            var mockVersionRepository = new Mock<IVersionRepository>();
            var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object
            };
            //------------Execute Test---------------------------
            var explorerItemModel = repository.ExplorerItemModels[0].Children[0];
            repository.RenameItem(explorerItemModel, "New Name");
        }
        public void StudioResourceRepository_RenameItem_ItemIsOnExplorerItemModelsAndNewNameParamIsEmpty_ThrowsException()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            mockExplorerResourceRepository.Setup(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()))
                                         .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"))
                                         .Verifiable();

            var environmentId = Guid.NewGuid();
            var workflowId = Guid.NewGuid();
            SetupEnvironmentRepo(environmentId);
            var mockVersionRepository = new Mock<IVersionRepository>();
            var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke)
                {
                    GetVersionProxy = id => mockVersionRepository.Object,
                    GetExplorerProxy = id => mockExplorerResourceRepository.Object
                };
            //------------Execute Test---------------------------
            var explorerItemModel = repository.ExplorerItemModels[0].Children[0];
            repository.RenameItem(explorerItemModel, "");
        }
        public void StudioResourceRepository_RenameItem_ItemIsOnExplorerItemModelsAndHasSameNameParam_DoesntCallRenameItemOnService()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            mockExplorerResourceRepository.Setup(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()))
                                          .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"))
                                          .Verifiable();

            var environmentId = Guid.NewGuid();
            var workflowId = Guid.NewGuid();
            SetupEnvironmentRepo(environmentId);
            var mockVersionRepository = new Mock<IVersionRepository>();
            var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object
            };
            //------------Execute Test---------------------------
            var explorerItemModel = repository.ExplorerItemModels[0].Children[0];
            repository.RenameItem(explorerItemModel, "folder1");
            //------------Assert Results-------------------------
            mockExplorerResourceRepository.Verify(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()), Times.Never());
        }