Beispiel #1
0
        public void StudioServerProxy_CreateFolder_VerifyFolderIsTrue()
        {
            //------------Setup for test--------------------------
            var commControllerFatoryMock = new Mock <ICommunicationControllerFactory>();
            var commController           = new Mock <ICommunicationController>();

            commController.Setup(controller => controller.ExecuteCommand <IExplorerRepositoryResult>(It.IsAny <IEnvironmentConnection>(), It.IsAny <Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Success, ""));
            ServerExplorerItem sendItem = null;
            var serialiser = new Dev2JsonSerializer();

            commController.Setup(controller => controller.AddPayloadArgument(It.IsAny <string>(), It.IsAny <StringBuilder>())).Callback((string key, StringBuilder builder) => {
                sendItem = serialiser.Deserialize <ServerExplorerItem>(builder);
            });
            commControllerFatoryMock.Setup(controller => controller.CreateController(It.IsAny <string>())).Returns(commController.Object);
            var studioServerProxy  = new StudioServerProxy(commControllerFatoryMock.Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;

            var resID   = Guid.NewGuid();
            var resName = "TestFolder";
            var resPath = "TestFolderPath";

            //------------Execute Test---------------------------
            studioServerProxy.CreateFolder(resPath, resName, resID);
            //------------Assert Results-------------------------
            Assert.AreEqual(resID, sendItem.ResourceId);
            Assert.AreEqual(resName, sendItem.DisplayName);
            Assert.AreEqual(resPath + "\\" + resName, sendItem.ResourcePath);
            Assert.AreEqual("Folder", sendItem.ResourceType);
            Assert.AreEqual(true, sendItem.IsFolder);
        }
Beispiel #2
0
        public void StudioServerProxy_CreateFolder_VerifyFolderCreated()
        {
            //------------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>();

            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.AddFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>()));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            studioServerProxy.CreateFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>());
            //------------Assert Results-------------------------
            updateManagerProxy.Verify(manager => manager.AddFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>()));
        }