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,93 @@
|
||||
using System.ComponentModel;
|
||||
using SpdUp.Core;
|
||||
|
||||
namespace SpdUp.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for ObservableObject base class.
|
||||
/// </summary>
|
||||
public class ObservableObjectTests
|
||||
{
|
||||
private sealed class TestObservable : ObservableObject
|
||||
{
|
||||
private string _name = string.Empty;
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
|
||||
private int _count;
|
||||
public int Count
|
||||
{
|
||||
get => _count;
|
||||
set => SetProperty(ref _count, value);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetProperty_NewValue_RaisesPropertyChanged()
|
||||
{
|
||||
var obj = new TestObservable();
|
||||
string? changedProp = null;
|
||||
obj.PropertyChanged += (_, e) => changedProp = e.PropertyName;
|
||||
|
||||
obj.Name = "hello";
|
||||
|
||||
Assert.Equal("Name", changedProp);
|
||||
Assert.Equal("hello", obj.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetProperty_SameValue_DoesNotRaisePropertyChanged()
|
||||
{
|
||||
var obj = new TestObservable { Name = "hello" };
|
||||
bool raised = false;
|
||||
obj.PropertyChanged += (_, _) => raised = true;
|
||||
|
||||
obj.Name = "hello";
|
||||
|
||||
Assert.False(raised);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetProperty_ReturnsTrue_WhenValueChanged()
|
||||
{
|
||||
var obj = new TestObservable();
|
||||
string? changedProp = null;
|
||||
obj.PropertyChanged += (_, e) => changedProp = e.PropertyName;
|
||||
|
||||
obj.Count = 42;
|
||||
|
||||
Assert.Equal("Count", changedProp);
|
||||
Assert.Equal(42, obj.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetProperty_ReturnsFalse_WhenValueUnchanged()
|
||||
{
|
||||
var obj = new TestObservable { Count = 5 };
|
||||
bool raised = false;
|
||||
obj.PropertyChanged += (_, _) => raised = true;
|
||||
|
||||
obj.Count = 5;
|
||||
|
||||
Assert.False(raised);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MultipleProperties_OnlyNotifyChanged()
|
||||
{
|
||||
var obj = new TestObservable();
|
||||
var notifications = new List<string>();
|
||||
obj.PropertyChanged += (_, e) => notifications.Add(e.PropertyName!);
|
||||
|
||||
obj.Name = "a";
|
||||
obj.Count = 1;
|
||||
obj.Name = "a"; // same – no notification
|
||||
obj.Count = 2;
|
||||
|
||||
Assert.Equal(3, notifications.Count);
|
||||
Assert.Equal(["Name", "Count", "Count"], notifications);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user