public FileEntryInfo(string name, FileSystemEntryId id, FileSystemEntryId parentId, long size) : base(name, id, parentId) { Size = size; }
public NodeDeletedEvent(FileSystemEntryId id) { Id = id; }
public void Given_PopulatedModel_When_UpdateWithReindexedEntries_Then_ShowValidTree() { var root = _fileSystemModel.LookupDirectory(_rootId); var tempFolderId = new FileSystemEntryId("ROOT\\temp"); var photosFolderId = new FileSystemEntryId("ROOT\\photos"); _fileSystemModel.PopulateWithIndexedEntries(root, new List <FileSystemModelEntry> { new DirectoryEntry(_fileSystemModel, tempFolderId, root, "temp"), new DirectoryEntry(_fileSystemModel, photosFolderId, root, "photos") }); var tempFolder = _fileSystemModel.LookupDirectory(tempFolderId); var photosFolder = _fileSystemModel.LookupDirectory(photosFolderId); _fileSystemModel.PopulateWithIndexedEntries(tempFolder, new List <FileSystemModelEntry> { new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\temp\\swap.swp"), tempFolder, "swap.swp", 64 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\temp\\temp.tmp"), tempFolder, "temp.tmp", 1024) }); _fileSystemModel.PopulateWithIndexedEntries(photosFolder, new List <FileSystemModelEntry> { new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\1.jpg"), photosFolder, "1.jpg", 2 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\2.jpg"), photosFolder, "2.jpg", 3 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\3.jpg"), photosFolder, "3.jpg", 1 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\4.jpg"), photosFolder, "4.jpg", 2 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\5.jpg"), photosFolder, "5.jpg", 1 * 1024) }); _fileSystemModel.Update(); _receivedEvents.Clear(); _fileSystemModel.UpdateWithIndexedEntries(photosFolder, new List <FileSystemEntryInfo> { new FileEntryInfo("1.jpg", new FileSystemEntryId("ROOT\\photos\\1.jpg"), photosFolderId, 2 * 1024), new FileEntryInfo("4.jpg", new FileSystemEntryId("ROOT\\photos\\4.jpg"), photosFolderId, 3 * 1024), new FileEntryInfo("6.jpg", new FileSystemEntryId("ROOT\\photos\\6.jpg"), photosFolderId, 2 * 1024), new FileEntryInfo("7.jpg", new FileSystemEntryId("ROOT\\photos\\7.jpg"), photosFolderId, 5 * 1024), new FileEntryInfo("8.jpg", new FileSystemEntryId("ROOT\\photos\\8.jpg"), photosFolderId, 4 * 1024) }); _fileSystemModel.Update(); var log = string.Join("\r\n", _receivedEvents); Assert.Equal( "CREATED ROOT\\photos\\6.jpg, ROOT\\photos, 6.jpg\r\n" + "CREATED ROOT\\photos\\7.jpg, ROOT\\photos, 7.jpg\r\n" + "CREATED ROOT\\photos\\8.jpg, ROOT\\photos, 8.jpg\r\n" + "DELETED ROOT\\photos\\2.jpg\r\n" + "DELETED ROOT\\photos\\3.jpg\r\n" + "DELETED ROOT\\photos\\5.jpg\r\n" + "CHANGED ROOT, 82944, 0, 1\r\n" + "CHANGED ROOT\\temp, 66560, 0, 0.802\r\n" + "CHANGED ROOT\\photos, 16384, 0.802, 1\r\n" + "CHANGED ROOT\\photos\\7.jpg, 5120, 0, 0.313\r\n" + "CHANGED ROOT\\photos\\8.jpg, 4096, 0.313, 0.563\r\n" + "CHANGED ROOT\\photos\\4.jpg, 3072, 0.563, 0.75\r\n" + "CHANGED ROOT\\photos\\6.jpg, 2048, 0.75, 0.875\r\n" + "CHANGED ROOT\\photos\\1.jpg, 2048, 0.875, 1", log); }
public DirectoryEntryInfo(string name, FileSystemEntryId id, FileSystemEntryId parentId) : base(name, id, parentId) { }
public FileEntry(FileSystemModel fileSystemModel, FileSystemEntryId id, DirectoryEntry parent, string name, long size) : base(fileSystemModel, id, parent, name, size) { }
public void Given_EmptyModel_When_Prepopulate_Then_ShowValidTree() { var root = _fileSystemModel.LookupDirectory(_rootId); var tempFolderId = new FileSystemEntryId("ROOT\\temp"); var photosFolderId = new FileSystemEntryId("ROOT\\photos"); _fileSystemModel.PopulateWithIndexedEntries(root, new List <FileSystemModelEntry> { new DirectoryEntry(_fileSystemModel, tempFolderId, root, "temp"), new DirectoryEntry(_fileSystemModel, photosFolderId, root, "photos") }); var tempFolder = _fileSystemModel.LookupDirectory(tempFolderId); var photosFolder = _fileSystemModel.LookupDirectory(photosFolderId); _fileSystemModel.PopulateWithIndexedEntries(tempFolder, new List <FileSystemModelEntry> { new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\temp\\swap.swp"), tempFolder, "swap.swp", 64 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\temp\\temp.tmp"), tempFolder, "temp.tmp", 1024) }); _fileSystemModel.PopulateWithIndexedEntries(photosFolder, new List <FileSystemModelEntry> { new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\1.jpg"), photosFolder, "1.jpg", 2 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\2.jpg"), photosFolder, "2.jpg", 3 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\3.jpg"), photosFolder, "3.jpg", 1 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\4.jpg"), photosFolder, "4.jpg", 2 * 1024), new FileEntry(_fileSystemModel, new FileSystemEntryId("ROOT\\photos\\5.jpg"), photosFolder, "5.jpg", 1 * 1024) }); _fileSystemModel.Update(); var log = string.Join("\r\n", _receivedEvents); Assert.Equal( "CREATED ROOT, , ROOT\r\n" + "CHANGED ROOT, 0, 0, 1\r\n" + "CREATED ROOT\\temp, ROOT, temp\r\n" + "CREATED ROOT\\temp\\swap.swp, ROOT\\temp, swap.swp\r\n" + "CREATED ROOT\\photos, ROOT, photos\r\n" + "CREATED ROOT\\photos\\2.jpg, ROOT\\photos, 2.jpg\r\n" + "CREATED ROOT\\photos\\1.jpg, ROOT\\photos, 1.jpg\r\n" + "CREATED ROOT\\photos\\4.jpg, ROOT\\photos, 4.jpg\r\n" + "CREATED ROOT\\photos\\3.jpg, ROOT\\photos, 3.jpg\r\n" + "CREATED ROOT\\photos\\5.jpg, ROOT\\photos, 5.jpg\r\n" + "CHANGED ROOT, 75776, 0, 1\r\n" + "CHANGED ROOT\\temp, 66560, 0, 0.878\r\n" + "CHANGED ROOT\\photos, 9216, 0.878, 1\r\n" + "CHANGED ROOT\\temp\\swap.swp, 65536, 0, 0.985\r\n" + "CREATED ROOT\\temp\\%%hidden%%, ROOT\\temp, \r\n" + "CHANGED ROOT\\temp\\%%hidden%%, 1024, 0.985, 1\r\n" + "CHANGED ROOT\\photos\\2.jpg, 3072, 0, 0.333\r\n" + "CHANGED ROOT\\photos\\1.jpg, 2048, 0.333, 0.556\r\n" + "CHANGED ROOT\\photos\\4.jpg, 2048, 0.556, 0.778\r\n" + "CHANGED ROOT\\photos\\3.jpg, 1024, 0.778, 0.889\r\n" + "CHANGED ROOT\\photos\\5.jpg, 1024, 0.889, 1", log); }
public NodeRenamedEvent(string name, FileSystemEntryId oldId, FileSystemEntryId newId) { Name = name; OldId = oldId; NewId = newId; }
protected FileSystemEntryInfo(string name, FileSystemEntryId id, FileSystemEntryId parentId) { Name = name; Id = id; ParentId = parentId; }
public DirectoryRenamedEvent(string name, FileSystemEntryId id, FileSystemEntryId oldId) : base(id) { Name = name ?? throw new ArgumentNullException(nameof(name)); OldId = oldId; }
public DirectoryEntry(FileSystemModel fileSystemModel, FileSystemEntryId id, DirectoryEntry parent, string name) : base(fileSystemModel, id, parent, name, 0) { _hiddenEntriesNodeId = new FileSystemEntryId(id.Path, true); }
public FileSystemUnrecoverableErrorEvent(FileSystemEntryId id, Exception exception) : base(id) { Exception = exception ?? throw new ArgumentNullException(nameof(exception)); }
public BufferOverflowEvent(FileSystemEntryId id) : base(id) { }
protected FileSystemEvent(FileSystemEntryId id) { Id = id; }