Skip to content

Uno Platform C# Markup template app for setting up GitHub Actions CI for unit, runtime, and UI tests with highest possible code coverage.

Notifications You must be signed in to change notification settings

jpnurmi/UnoMarkupApp

Repository files navigation

UnoMarkupApp

CI codecov

Uno Platform C# Markup template app for setting up GitHub Actions CI for unit, runtime, and UI tests with highest possible code coverage.

dotnet new unoapp \
  -platforms desktop \
  -platforms wasm \
  -markup csharp \
  -di \
  -presentation mvvm \
  -nav regions \
  -tests unit \
  -tests ui \
  -ci github

Tests (AI-generated with focus on coverage, not test quality 😄)

Note

Coverlet 6.0.x fails to collect coverage for binding expressions using the convenience syntax.

new Control()
  .Foo(() => vm.Foo) // ❌
  .Bar(x => x.Binding(() => vm.Bar)) // ✅
Example
diff --git a/UnoMarkupApp/Presentation/MainPage.cs b/UnoMarkupApp/Presentation/MainPage.cs
index 66759b5..1e402ef 100644
--- a/UnoMarkupApp/Presentation/MainPage.cs
+++ b/UnoMarkupApp/Presentation/MainPage.cs
@@ -11,7 +11,7 @@ public sealed partial class MainPage : Page
                 .RowDefinitions("Auto,*")
                 .Children(
                     new TextBlock()
-                        .Text(() => vm.Title)
+                        .Text(x => x.Binding(() => vm.Title))
                         .HorizontalAlignment(HorizontalAlignment.Center),
                     new StackPanel()
                         .Grid(row: 1)
@@ -25,7 +25,7 @@ public sealed partial class MainPage : Page
                             new Button()
                                 .Content("Go to Second Page")
                                 .AutomationProperties(automationId: "SecondPageButton")
-                                .Command(() => vm.GoToSecond)
+                                .Command(x => x.Binding(() => vm.GoToSecond))
                                 ))));
     }

diff --git a/UnoMarkupApp/Presentation/SecondPage.cs b/UnoMarkupApp/Presentation/SecondPage.cs
index 624068d..1ad95f5 100644
--- a/UnoMarkupApp/Presentation/SecondPage.cs
+++ b/UnoMarkupApp/Presentation/SecondPage.cs
@@ -12,7 +12,7 @@ public sealed partial class SecondPage : Page
                     .Text("Second Page")
                     .HorizontalAlignment(HorizontalAlignment.Center),
                 new TextBlock()
-                    .Text(() => vm.Entity.Name)
+                    .Text(x => x.Binding(() => vm.Entity.Name))
                     .HorizontalAlignment(HorizontalAlignment.Center)
                     .VerticalAlignment(VerticalAlignment.Center))));
     }

Codecov: +2.44%

About

Uno Platform C# Markup template app for setting up GitHub Actions CI for unit, runtime, and UI tests with highest possible code coverage.

Topics

Resources

Stars

Watchers

Forks