public void CompareCQLDirectory(CQLDirectory expected, CQLDirectory actual) { if (expected == null && actual == null) { return; } expected.Should().NotBeNull(); actual.Should().NotBeNull(); actual.Name.Should().Be(expected.Name); actual.Path.Should().Be(expected.Path); actual.GID.Should().Be(expected.GID); actual.UID.Should().Be(expected.UID); actual.ModifiedTimestamp.Should().BeCloseTo(expected.ModifiedTimestamp); actual.FilePermissions.Should().BeGreaterOrEqualTo(expected.FilePermissions); }
public void TestCreateManyFileSystemEntriesAndItExistsAfterReconnect() { var root = GetTestDirectoryModel(Path.DirectorySeparatorChar.ToString()); directoryRepository.WriteDirectory(root); var rootPath = root.Path + root.Name; var directories = new DirectoryModel[50]; var cqlDirectories = new CQLDirectory[50]; var files = new FileModel[50]; var cqlFiles = new CQLFile[50]; for (var i = 0; i < 50; i++) { var directory = GetTestDirectoryModel(rootPath); var cqlDirectory = GetCQLDirectoryFromDirectoryModel(directory); directoryRepository.WriteDirectory(directory); directories[i] = directory; cqlDirectories[i] = cqlDirectory; var file = GetTestFileModel(rootPath); var cqlFile = GetCQLFileFromFileModel(file); fileRepository.WriteFile(file); files[i] = file; cqlFiles[i] = cqlFile; } OneTimeSetup(); for (var i = 0; i < 50; i++) { var directory = directories[i]; var cqlDirectory = cqlDirectories[i]; var actualDirectory = directoryRepository.ReadDirectory(directory.Path + Path.DirectorySeparatorChar + directory.Name); var actualCQLDirectory = ReadCQLDirectory(directory.Path, directory.Name); CompareDirectoryModel(directory, actualDirectory); CompareCQLDirectory(cqlDirectory, actualCQLDirectory); CompareDirectoryStat(directory.GetStat(), actualDirectory.GetStat()); var file = files[i]; var cqlFile = cqlFiles[i]; var actualFile = fileRepository.ReadFile(file.Path + Path.DirectorySeparatorChar + file.Name); var actualCQLFile = ReadCQLFile(file.Path, file.Name); CompareFileModel(file, actualFile); CompareCQLFile(cqlFile, actualCQLFile); CompareFileStat(file.GetStat(), actualFile.GetStat()); } }