Initial commit: SpdUp Windows Gaming Booster v1.0.0
- .NET 8 WPF app with full MVVM architecture - One-click boost: CPU, RAM, GPU, network, services, timer resolution - Real-time system monitor (LibreHardwareMonitor) - Auto game detection (30+ games) - RAM optimizer with kernel-level cleanup - Network optimizer (TCP registry tweaks) - Service manager, process manager, shader cache cleaner - Desktop widget overlay - Debug log viewer - Custom dark gaming theme with trans pride colors - 84 unit tests (xUnit) - Inno Setup installer script - Landing page website
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
using SpdUp.Core;
|
||||
|
||||
namespace SpdUp.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for RelayCommand and RelayCommand<T>.
|
||||
/// </summary>
|
||||
public class RelayCommandTests
|
||||
{
|
||||
[Fact]
|
||||
public void Execute_InvokesAction()
|
||||
{
|
||||
bool executed = false;
|
||||
var cmd = new RelayCommand(() => executed = true);
|
||||
|
||||
cmd.Execute(null);
|
||||
|
||||
Assert.True(executed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Execute_WithParameter_InvokesParameterizedAction()
|
||||
{
|
||||
object? received = null;
|
||||
var cmd = new RelayCommand(p => received = p);
|
||||
|
||||
cmd.Execute("test");
|
||||
|
||||
Assert.Equal("test", received);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanExecute_DefaultsToTrue()
|
||||
{
|
||||
var cmd = new RelayCommand(() => { });
|
||||
|
||||
Assert.True(cmd.CanExecute(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanExecute_RespectsCanExecuteFunc()
|
||||
{
|
||||
var cmd = new RelayCommand(() => { }, () => false);
|
||||
|
||||
Assert.False(cmd.CanExecute(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanExecute_ParameterizedPredicate()
|
||||
{
|
||||
var cmd = new RelayCommand(_ => { }, p => p is "go");
|
||||
|
||||
Assert.True(cmd.CanExecute("go"));
|
||||
Assert.False(cmd.CanExecute("stop"));
|
||||
Assert.False(cmd.CanExecute(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_ThrowsOnNullAction()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new RelayCommand((Action<object?>)null!));
|
||||
}
|
||||
|
||||
// ── Generic RelayCommand<T> ──────────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void Generic_Execute_InvokesWithTypedParameter()
|
||||
{
|
||||
string? received = null;
|
||||
var cmd = new RelayCommand<string>(s => received = s);
|
||||
|
||||
cmd.Execute("hello");
|
||||
|
||||
Assert.Equal("hello", received);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Generic_CanExecute_DefaultsToTrue()
|
||||
{
|
||||
var cmd = new RelayCommand<int>(_ => { });
|
||||
|
||||
Assert.True(cmd.CanExecute(42));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Generic_CanExecute_RespectsFunc()
|
||||
{
|
||||
var cmd = new RelayCommand<int>(_ => { }, n => n > 0);
|
||||
|
||||
Assert.True(cmd.CanExecute(5));
|
||||
Assert.False(cmd.CanExecute(-1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Generic_Constructor_ThrowsOnNullAction()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new RelayCommand<string>(null!));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user