Example #1
0
        public void TestSetUnixOwnerRecursive()
        {
            List <string> expectedItemsToOwn = new List <string>()
            {
                _directoryPath,
                _subdirectoryPath,
                _directoryFilePath,
                _subdirectoryFilePath
            };

            _systemOperations.SetUnixOwnerIfNeeded(_directoryPath, true);

            expectedItemsToOwn.ForEach(
                (item) => _mockFileSystemOperations.Verify(x => x.SetUnixOwner(It.Is <string>((path) => path == item), _systemOperations.User), Times.Once));
        }
Example #2
0
        public void TestSetUnixOwnerDoesNothing()
        {
            List <string> expectedItemsToOwn = new List <string>()
            {
                _directoryPath,
                _subdirectoryPath,
                _directoryFilePath,
                _subdirectoryFilePath
            };
            VmConfiguration  config           = new VmConfiguration(56001, "vmid", new VmDirectories("root"), false);
            SystemOperations systemOperations = new SystemOperations(config, _logger, _mockFileSystemOperations.Object);

            systemOperations.SetUnixOwnerIfNeeded(_directoryPath, true);
            expectedItemsToOwn.ForEach(
                (item) => _mockFileSystemOperations.Verify(x => x.SetUnixOwner(It.IsAny <string>(), It.IsAny <string>()), Times.Never));
        }