public UpdateRootAndFoldersPermissions ( Permissions modifiedPermissions, Guid environmentGuid, bool updateRoot = true ) : void | ||
modifiedPermissions | Permissions | |
environmentGuid | Guid | |
updateRoot | bool | |
Результат | void |
public void StudioResourceRepository_UpdateRootAndFoldersPermissions_SetPermissionsToView_ExplorerItemsAreUpdatedToView() { //------------Setup for test-------------------------- var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>(); var mockVersionRepository = new Mock<IVersionRepository>(); var parent = new ServerExplorerItem { ResourceType = ResourceType.Server, DisplayName = "Azure server", ResourceId = Guid.NewGuid(), Permissions = Permissions.Contribute, ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER" }; SetupEnvironmentRepo(Guid.Empty); var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke) { GetVersionProxy = id => mockVersionRepository.Object, GetExplorerProxy = id => mockExplorerResourceRepository.Object, GetCurrentEnvironment = () => Guid.Empty }; repo.GetCurrentEnvironment = () => Guid.Empty; //------------Execute Test--------------------------- repo.UpdateRootAndFoldersPermissions(Permissions.View, Guid.Empty); //------------Assert Results------------------------- var permissions = repo.ExplorerItemModels.First().Descendants().Select(s => s.Permissions); Assert.IsTrue(permissions.All(p => p == Permissions.View)); }