예제 #1
0
        public void StudioServerProxy_Rename_WhenNotFolder_ShouldRenameResourceId()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            mockQueryManager.Setup(manager => manager.FetchDependants(It.IsAny <Guid>())).Returns(new ExecuteMessage());
            mockVersionManager.Setup(manager => manager.DeleteVersion(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>())).Verifiable();
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.Rename(It.IsAny <Guid>(), It.IsAny <string>()));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            var mockExplorerItemModel = new Mock <IExplorerItemViewModel>();

            mockExplorerItemModel.SetupAllProperties();
            mockExplorerItemModel.Setup(model => model.ResourceType).Returns("Resource");
            var mockPopupController = new Mock <IPopupController>();

            mockPopupController.Setup(controller => controller.Show(It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.OK, MessageBoxImage.Error, "false", true, true, false, false, false, false)).Returns(MessageBoxResult.OK);
            CustomContainer.Register(mockPopupController.Object);
            //------------Execute Test---------------------------
            var item = studioServerProxy.Rename(mockExplorerItemModel.Object, It.IsAny <string>());

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);
            updateManagerProxy.Setup(manager => manager.Rename(It.IsAny <Guid>(), It.IsAny <string>()));
        }
예제 #2
0
        public void StudioServerProxy_Rename_WhenNullItem_ShouldThrowException()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);

            //------------Execute Test---------------------------
            studioServerProxy.Rename(default(IExplorerItemViewModel), It.IsAny <string>());
            //------------Assert Results-------------------------
        }