-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to Net8, Update StartupProcessor, use ConcurrentDictionary fo…
…r inmemory datastore, and fix security vulnerability
- Loading branch information
Showing
35 changed files
with
430 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Edge.MyMusic/src/Edge.MyMusic.Tests/StartupProcessorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Edge.MyMusic.Processors; | ||
using Edge.MyMusic.Providers; | ||
using Edge.MyMusic.Repositories; | ||
using Edge.MyMusic.Settings; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Edge.MyMusic.Tests; | ||
|
||
public class StartupProcessorTests | ||
{ | ||
private readonly Mock<ILogger<StartupProcessor>> _logger; | ||
private readonly Mock<IMusicRepository> _repo; | ||
private readonly Mock<IAudioProvider> _audioProvider; | ||
private readonly Mock<IArgsSetting> _setting; | ||
|
||
private readonly StartupProcessor _processor; | ||
|
||
public StartupProcessorTests() | ||
{ | ||
_logger = new Mock<ILogger<StartupProcessor>>(); | ||
_repo = new Mock<IMusicRepository>(); | ||
_audioProvider = new Mock<IAudioProvider>(); | ||
_setting = new Mock<IArgsSetting>(); | ||
|
||
_processor = new StartupProcessor(_logger.Object, _repo.Object, _audioProvider.Object, _setting.Object); | ||
} | ||
|
||
[Fact] | ||
public async Task CanStartAsync() | ||
{ | ||
// ACT | ||
await _processor.StartAsync(default); | ||
|
||
// ASSERT | ||
_logger.Verify( | ||
log => log.Log( | ||
It.Is<LogLevel>(l => l == LogLevel.Information), | ||
It.IsAny<EventId>(), | ||
It.Is<It.IsAnyType>((v, t) => v.ToString() == $"{nameof(StartupProcessor)} is starting..."), | ||
It.IsAny<Exception>(), | ||
It.Is<Func<It.IsAnyType, Exception?, string>>((v, t) => true)), | ||
Times.Once); | ||
} | ||
|
||
[Fact] | ||
public async Task CanStopAsync() | ||
{ | ||
// ACT | ||
await _processor.StopAsync(default); | ||
|
||
// ASSERT | ||
_logger.Verify( | ||
log => log.Log( | ||
It.Is<LogLevel>(l => l == LogLevel.Information), | ||
It.IsAny<EventId>(), | ||
It.Is<It.IsAnyType>((v, t) => v.ToString() == $"{nameof(StartupProcessor)} is stopping..."), | ||
It.IsAny<Exception>(), | ||
It.Is<Func<It.IsAnyType, Exception?, string>>((v, t) => true)), | ||
Times.Once); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Edge.MyMusic.Processors; | ||
|
||
public abstract class BaseProcessor: IHostedLifecycleService | ||
{ | ||
public virtual Task StartingAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
public virtual Task StartAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
public virtual Task StartedAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
public virtual Task StoppingAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
public virtual Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
public virtual Task StoppedAsync(CancellationToken cancellationToken) => Task.CompletedTask; | ||
} |
20 changes: 0 additions & 20 deletions
20
Edge.MyMusic/src/Edge.MyMusic/Processors/MapperExtension.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.