• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

abatar1 / CyclicalFileWatcher / 15101239823

18 May 2025 11:43PM UTC coverage: 52.149% (+40.5%) from 11.672%
15101239823

push

github

abatar1
Refactor and modularize file watcher implementation.

Introduced interfaces and modular components to improve flexibility and testability of the file watcher system. Implemented `FileWatchProcessor`, `IFileStateStorage`, and `IFileSystemProxy` for clearer responsibilities, and replaced inline logic with reusable abstractions. Added comprehensive inline comments and enforced proper resource management with asynchronous disposals.

29 of 68 branches covered (42.65%)

Branch coverage included in aggregate %.

92 of 134 new or added lines in 7 files covered. (68.66%)

4 existing lines in 2 files now uncovered.

153 of 281 relevant lines covered (54.45%)

11.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.15
/src/CyclicalFileWatcher/Internals/FileStateStorageRepository.cs
1
using System.Collections.Concurrent;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Threading.Tasks;
5
using FileWatcher.Base;
6

7
namespace FileWatcher.Internals;
8

9
internal sealed class FileStateStorageRepository<TFileStateContent>(IFileSystemProxy fileSystemProxy)
1✔
10
    : IFileStateStorageRepository<TFileStateContent>
11
    where TFileStateContent : IFileStateContent
12
{
13
    private readonly ConcurrentDictionary<FileStateIdentifier, IFileStateStorage<TFileStateContent>> _storages = new();
1✔
14

15
    public List<IFileStateStorage<TFileStateContent>> GetAll()
16
    {
17
        return _storages.Values.ToList();
74✔
18
    }
19

20
    public bool TryGetValue(FileStateIdentifier identifier, out IFileStateStorage<TFileStateContent> value)
21
    {
22
        return _storages.TryGetValue(identifier, out value);
5✔
23
    }
24

25
    public void Set(FileStateIdentifier identifier, IFileWatcherParameters<TFileStateContent> fileWatcherParameters)
26
    {
NEW
27
        _storages.GetOrAdd(identifier, new FileStateStorage<TFileStateContent>(fileWatcherParameters, fileSystemProxy));
×
NEW
28
    }
×
29
    
30
    internal void Set(FileStateIdentifier identifier, IFileStateStorage<TFileStateContent> storage)
31
    {
32
        _storages.GetOrAdd(identifier, storage);
1✔
33
    }
1✔
34
    
35
    public async ValueTask DisposeAsync()
36
    {
NEW
37
        foreach (var storage in _storages.Values)
×
NEW
38
            await storage.DisposeAsync();
×
NEW
39
    }
×
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc