Ejemplo n.º 1
0
        public void WhenICreateTheFolder(string folderName)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            var repository       = new ServerExplorerClientProxy(environmentModel.Connection);

            Assert.AreEqual(0, repository.Load(Guid.Empty).Children.Count(a => a.DisplayName == folderName));

            var result = repository.AddItem(new ServerExplorerItem(folderName, Guid.NewGuid(), ResourceType.Folder, null, Permissions.Administrator, ""), Guid.Empty);

            Assert.AreEqual(result.Status, ExecStatus.Success);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("explorerItemModel", explorerItemModel);
            ScenarioContext.Current.Add("folderName", folderName);
        }
Ejemplo n.º 2
0
        public void WhenResourcesAreLoadedFor(string serverName)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == serverName);
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add(serverName, explorerItemModel);
        }
Ejemplo n.º 3
0
        public void WhenIDeleteTheResource(string p0)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);
            var item = repository.Load(Guid.Empty).Children.First(a => a.DisplayName == "ExplorerSpecsDeleteItem")
                       .Children.First();


            var result = repository.DeleteItem(item, Guid.Empty);

            Assert.AreEqual(result.Status, ExecStatus.Success);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("localhost", explorerItemModel);
            ScenarioContext.Current.Add("newName", explorerItemModel);
            ScenarioContext.Current.Add("folderName", "ExplorerSpecsDeleteItem");
        }
Ejemplo n.º 4
0
        public void WhenIRenameTheFolderFolderToRenameTo(string p0)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);
            var result = repository.RenameItem(new ServerExplorerItem("FolderToRename", Guid.NewGuid(), ResourceType.Folder, null, Permissions.Administrator, "FolderToRename"), p0, Guid.Empty);

            Assert.AreEqual(result.Status, ExecStatus.Success);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("localhost", explorerItemModel);
            ScenarioContext.Current.Add("newName", explorerItemModel);
        }
Ejemplo n.º 5
0
        public void WhenIRenameTheResourceTo(string itemToRename, string p1)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);
            var item = repository.Load(Guid.Empty)
                       .Children.First(a => a.DisplayName == "ExplorerSpecsRenameItem")
                       .Children.FirstOrDefault(a => a.DisplayName == itemToRename);

            if (item != null)
            {
                item.DisplayName = p1;

                var result = repository.RenameItem(item, p1, Guid.Empty);
                Assert.AreEqual(result.Status, ExecStatus.Success);
            }
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("localhost", explorerItemModel);
            ScenarioContext.Current.Add("newName", explorerItemModel);
            ScenarioContext.Current.Add("folderName", "ExplorerSpecsRenameItem");
        }
Ejemplo n.º 6
0
        public void WhenIRenameTheFolderTo(string folderToRename, string newName)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);
            var result = repository.RenameItem(new ServerExplorerItem(folderToRename, Guid.NewGuid(), Common.Interfaces.Data.ResourceType.Folder, null, Permissions.Administrator, ""), newName, Guid.Empty);

            Assert.AreEqual(ExecStatus.Success, result.Status, "Rename failed: " + result.Message);
            var explorerItemModel = repository.Load(Guid.Empty);

            ScenarioContext.Current.Add("localhost", explorerItemModel);
            ScenarioContext.Current.Add("newName", explorerItemModel);
            ScenarioContext.Current.Add("folderName", newName);
        }
Ejemplo n.º 7
0
        public void WhenIDeleteTheFolderWithoutRecursiveDeleteFlag(string folderToDelete)
        {
            var environmentModel = EnvironmentRepository.Instance.FindSingle(model => model.Name == "localhost");
            ServerExplorerClientProxy repository = new ServerExplorerClientProxy(environmentModel.Connection);


            var result = repository.DeleteItem(new ServerExplorerItem(folderToDelete, Guid.NewGuid(), ResourceType.Folder, null, Permissions.Administrator, ""), Guid.Empty);

            Assert.AreEqual(result.Status, ExecStatus.Success);
            var explorerItemModel = repository.Load(Guid.Empty);

            Assert.IsFalse(0 == explorerItemModel.Children.Count(a => a.DisplayName == folderToDelete));
            ScenarioContext.Current.Add("localhost", explorerItemModel);
            ScenarioContext.Current.Add("newName", explorerItemModel);
        }
Ejemplo n.º 8
0
        public void ClientExplorerRepository_ClientExplorerRepository_ExpectLoadCalled_ExpectExecCalled()
        {
            //------------Setup for test--------------------------
            var env        = new Mock <IEnvironmentConnection>();
            var comFactory = new Mock <ICommunicationControllerFactory>();
            var rep        = new ServerExplorerClientProxy(env.Object, comFactory.Object);
            var com        = new Mock <ICommunicationController>();
            var item       = new Mock <IExplorerItem>();

            comFactory.Setup(a => a.CreateController("FetchExplorerItemsService")).Returns(com.Object).Verifiable();
            com.Setup(a => a.ExecuteCommand <IExplorerItem>(env.Object, Guid.Empty)).Returns(item.Object).Verifiable();

            //------------Execute Test---------------------------
            rep.Load(Guid.Empty);
            //------------Assert Results-------------------------

            comFactory.Verify(a => a.CreateController("FetchExplorerItemsService"));
            com.Verify(a => a.ExecuteCommand <IExplorerItem>(env.Object, Guid.Empty));
        }