diff --git a/YKanBan.Tests/MSTestSettings.cs b/YKanBan.Tests/MSTestSettings.cs new file mode 100644 index 0000000..8b7de71 --- /dev/null +++ b/YKanBan.Tests/MSTestSettings.cs @@ -0,0 +1 @@ +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] \ No newline at end of file diff --git a/YKanBan.Tests/SmokeTests.cs b/YKanBan.Tests/SmokeTests.cs new file mode 100644 index 0000000..78c0ebb --- /dev/null +++ b/YKanBan.Tests/SmokeTests.cs @@ -0,0 +1,17 @@ +using YKanBan.ViewModels; + +namespace YKanBan.Tests; + +/// +/// Smoke tests verifying the wiring between the test project and the main application project. +/// +[TestClass] +public sealed class SmokeTests { + /// + /// Verifies that the main application assembly is referenced and can be resolved at runtime. + /// + [TestMethod] + public void MainAssemblyIsReferenced() { + Assert.AreEqual("YKanBan", typeof(ViewModelBase).Assembly.GetName().Name); + } +} \ No newline at end of file diff --git a/YKanBan.Tests/YKanBan.Tests.csproj b/YKanBan.Tests/YKanBan.Tests.csproj new file mode 100644 index 0000000..5784a44 --- /dev/null +++ b/YKanBan.Tests/YKanBan.Tests.csproj @@ -0,0 +1,23 @@ + + + + net9.0 + latest + enable + enable + false + + + + + + + + + + + + + + + diff --git a/YKanBan.slnx b/YKanBan.slnx index c37ab03..e8e8e7d 100644 --- a/YKanBan.slnx +++ b/YKanBan.slnx @@ -1,3 +1,4 @@ + diff --git a/YKanBan/App.axaml b/YKanBan/App.axaml index 2ba681d..9c1662e 100644 --- a/YKanBan/App.axaml +++ b/YKanBan/App.axaml @@ -1,15 +1,10 @@ - + - - - - - \ No newline at end of file + diff --git a/YKanBan/App.axaml.cs b/YKanBan/App.axaml.cs index 0c02113..6976159 100644 --- a/YKanBan/App.axaml.cs +++ b/YKanBan/App.axaml.cs @@ -1,30 +1,30 @@ +using System.Linq; + using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; -using System.Linq; using Avalonia.Markup.Xaml; + using YKanBan.ViewModels; using YKanBan.Views; namespace YKanBan; -public partial class App : Application -{ - public override void Initialize() - { +/// +/// Application class controlling the desktop lifetime and the root window composition. +/// +public partial class App : Application { + public override void Initialize() { AvaloniaXamlLoader.Load(this); } - public override void OnFrameworkInitializationCompleted() - { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - // Avoid duplicate validations from both Avalonia and the CommunityToolkit. + public override void OnFrameworkInitializationCompleted() { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { + // Avoid duplicate validations from both Avalonia and the CommunityToolkit. // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins DisableAvaloniaDataAnnotationValidation(); - desktop.MainWindow = new MainWindow - { + desktop.MainWindow = new MainWindow { DataContext = new MainWindowViewModel(), }; } @@ -32,15 +32,13 @@ public partial class App : Application base.OnFrameworkInitializationCompleted(); } - private void DisableAvaloniaDataAnnotationValidation() - { - // Get an array of plugins to remove + private void DisableAvaloniaDataAnnotationValidation() { + // Collect the Avalonia data-validation plugins that clash with the CommunityToolkit. var dataValidationPluginsToRemove = BindingPlugins.DataValidators.OfType().ToArray(); - // remove each entry found - foreach (var plugin in dataValidationPluginsToRemove) - { + // Remove every plugin found so validation runs only once. + foreach (var plugin in dataValidationPluginsToRemove) { BindingPlugins.DataValidators.Remove(plugin); } } diff --git a/YKanBan/Assets/avalonia-logo.ico b/YKanBan/Assets/avalonia-logo.ico deleted file mode 100644 index f7da8bb..0000000 Binary files a/YKanBan/Assets/avalonia-logo.ico and /dev/null differ diff --git a/YKanBan/Program.cs b/YKanBan/Program.cs index bbc7334..b79267e 100644 --- a/YKanBan/Program.cs +++ b/YKanBan/Program.cs @@ -1,21 +1,25 @@ -using Avalonia; -using System; +using System; + +using Avalonia; namespace YKanBan; -sealed class Program -{ - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. +/// +/// Application entry point that bootstraps and launches the Avalonia desktop application. +/// +sealed class Program { + /// + /// Starts the application with the classic desktop lifetime. + /// [STAThread] public static void Main(string[] args) => BuildAvaloniaApp() .StartWithClassicDesktopLifetime(args); - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .WithInterFont() - .LogToTrace(); -} + /// + /// Builds the Avalonia application configuration; also used by the visual designer. + /// + public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() + .UsePlatformDetect() + .WithInterFont() + .LogToTrace(); +} \ No newline at end of file diff --git a/YKanBan/ViewLocator.cs b/YKanBan/ViewLocator.cs deleted file mode 100644 index 651f07e..0000000 --- a/YKanBan/ViewLocator.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Avalonia.Controls; -using Avalonia.Controls.Templates; -using YKanBan.ViewModels; - -namespace YKanBan; - -public class ViewLocator : IDataTemplate -{ - - public Control? Build(object? param) - { - if (param is null) - return null; - - var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); - var type = Type.GetType(name); - - if (type != null) - { - return (Control)Activator.CreateInstance(type)!; - } - - return new TextBlock { Text = "Not Found: " + name }; - } - - public bool Match(object? data) - { - return data is ViewModelBase; - } -} diff --git a/YKanBan/ViewModels/MainWindowViewModel.cs b/YKanBan/ViewModels/MainWindowViewModel.cs index 68fb1ed..87dca9d 100644 --- a/YKanBan/ViewModels/MainWindowViewModel.cs +++ b/YKanBan/ViewModels/MainWindowViewModel.cs @@ -1,6 +1,7 @@ namespace YKanBan.ViewModels; -public partial class MainWindowViewModel : ViewModelBase -{ - public string Greeting { get; } = "Welcome to Avalonia!"; -} +/// +/// View model for the main application window. +/// +public partial class MainWindowViewModel : ViewModelBase { +} \ No newline at end of file diff --git a/YKanBan/ViewModels/ViewModelBase.cs b/YKanBan/ViewModels/ViewModelBase.cs index 5b2f8b5..1e908ac 100644 --- a/YKanBan/ViewModels/ViewModelBase.cs +++ b/YKanBan/ViewModels/ViewModelBase.cs @@ -2,6 +2,8 @@ namespace YKanBan.ViewModels; -public class ViewModelBase : ObservableObject -{ -} +/// +/// Base class for all view models, providing property change notification. +/// +public class ViewModelBase : ObservableObject { +} \ No newline at end of file diff --git a/YKanBan/Views/MainWindow.axaml b/YKanBan/Views/MainWindow.axaml index 2233ddf..b1aac04 100644 --- a/YKanBan/Views/MainWindow.axaml +++ b/YKanBan/Views/MainWindow.axaml @@ -1,20 +1,8 @@ - - - - - - - - diff --git a/YKanBan/Views/MainWindow.axaml.cs b/YKanBan/Views/MainWindow.axaml.cs index d50dd51..40b1b54 100644 --- a/YKanBan/Views/MainWindow.axaml.cs +++ b/YKanBan/Views/MainWindow.axaml.cs @@ -2,10 +2,11 @@ using Avalonia.Controls; namespace YKanBan.Views; -public partial class MainWindow : Window -{ - public MainWindow() - { +/// +/// Main application window hosting the kanban user interface. +/// +public partial class MainWindow : Window { + public MainWindow() { InitializeComponent(); } } \ No newline at end of file diff --git a/YKanBan/YKanBan.csproj b/YKanBan/YKanBan.csproj index bd99f8a..06fcbfc 100644 --- a/YKanBan/YKanBan.csproj +++ b/YKanBan/YKanBan.csproj @@ -8,11 +8,6 @@ true - - - - - @@ -23,6 +18,11 @@ None All + + + + +