public void WhenIDeleteTheFolder(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); ScenarioContext.Current.Add("localhost", explorerItemModel); ScenarioContext.Current.Add("folderName", folderToDelete); }
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(), Common.Interfaces.Data.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 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 ClientExplorerRepository_DeleteItemItem_ExpectDeleteServiceCalled() { //------------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 ServerExplorerItem("", Guid.Empty, ResourceType.DbService, null, Permissions.Contribute, "f"); comFactory.Setup(a => a.CreateController("DeleteItemService")).Returns(com.Object).Verifiable(); com.Setup(a => a.ExecuteCommand <IExplorerItem>(env.Object, Guid.Empty)).Returns(item).Verifiable(); //------------Execute Test--------------------------- rep.DeleteItem(item, Guid.Empty); //------------Assert Results------------------------- comFactory.Verify(a => a.CreateController("DeleteItemService")); com.Verify(a => a.ExecuteCommand <IExplorerRepositoryResult>(env.Object, Guid.Empty)); com.Verify(a => a.AddPayloadArgument("itemToDelete", It.IsAny <string>())); com.Verify(a => a.ExecuteCommand <IExplorerRepositoryResult>(env.Object, Guid.Empty)); }