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); }
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); }
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"); }
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); }
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"); }
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); }
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); }
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)); }