Skip to content

Rename reorganize prepare for update #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
fb40c8b
Rename Reduce to Update
Carl-Hugo Dec 24, 2021
8cad84e
Rename StateR.Updater to StateR.Updaters
Carl-Hugo Dec 24, 2021
56a0801
Update CancellationToken
Carl-Hugo Dec 24, 2021
9fed1b9
Update to .NET 6
Carl-Hugo Dec 24, 2021
b0a2df9
Add csharp_style_namespace_declarations
Carl-Hugo Dec 24, 2021
293b1e4
Enable Nullable and ImplicitUsings options
Carl-Hugo Dec 24, 2021
1690b8c
Update to file-scoped namespace
Carl-Hugo Dec 24, 2021
906b6fa
Enable ImplicitUsings
Carl-Hugo Dec 24, 2021
a338ebb
Cleanup usings
Carl-Hugo Dec 24, 2021
1744a5f
Update nullables
Carl-Hugo Dec 24, 2021
38975a3
Info fixes
Carl-Hugo Dec 24, 2021
4d223cd
Update StateR.Blazor.Experiments to .NET 6
Carl-Hugo Dec 24, 2021
4ab6cb2
Remove `Use range operator` messages
Carl-Hugo Dec 24, 2021
2d8a896
Update GitVersioning and SourceLink
Carl-Hugo Dec 28, 2021
e77b1ee
Add counter sample project
Carl-Hugo Dec 28, 2021
dad42f0
Cleanup build properties
Carl-Hugo Dec 28, 2021
74f5e76
Add an App component test
Carl-Hugo Dec 28, 2021
4b5fa2b
Statorize Counter page and add tests
Carl-Hugo Dec 28, 2021
a468bbb
Formatting update
Carl-Hugo Dec 28, 2021
4ac7de6
Cleanup using
Carl-Hugo Dec 28, 2021
1415e26
Add WeatherForecast feature
Carl-Hugo Dec 28, 2021
3374cce
Update console text
Carl-Hugo Dec 28, 2021
bfef21d
Change classes order
Carl-Hugo Dec 28, 2021
4d53022
Hide Dispose
Carl-Hugo Dec 28, 2021
21f60cd
Add TODO comment
Carl-Hugo Dec 28, 2021
acb2dfd
Add ErrorToastStack and better handle failures
Carl-Hugo Dec 28, 2021
d9a14a2
Add AsyncOperationSwitch control
Carl-Hugo Dec 28, 2021
e5d22b3
AddReduxDevTools
Carl-Hugo Dec 28, 2021
def8e04
Add Dispatch components
Carl-Hugo Dec 28, 2021
1d2be68
Add fluent validation experiments
Carl-Hugo Dec 31, 2021
65721c7
Experiments with session storage and state validation
Carl-Hugo Dec 31, 2021
9be4b5b
Update FluentValidation
Carl-Hugo Jan 9, 2022
ac9125b
Simplify onclick
Carl-Hugo Jan 9, 2022
f0fdfa9
Implement WebStorage wrapper
Carl-Hugo Jan 9, 2022
ee11cd0
Add extensibility
Carl-Hugo Jan 9, 2022
604c862
Inject the default IStorage instead of IWebStorage
Carl-Hugo Jan 9, 2022
cc73193
Move Persistance away from app
Carl-Hugo Jan 9, 2022
4c1f673
Remove assembly re-scanning
Carl-Hugo Jan 9, 2022
3d7e19d
Extracted StateR.Blazor.WebStorage to ForEvolve.Blazor.WebStorage
Carl-Hugo Jan 13, 2022
9140841
Core updates
Carl-Hugo Jan 15, 2022
03f5c53
wip
Carl-Hugo Mar 2, 2022
c8d121d
Remove old tests
Carl-Hugo Mar 2, 2022
8d52371
Register IState<T>
Carl-Hugo Mar 3, 2022
778eeba
Make Store internal
Carl-Hugo Mar 3, 2022
9b13046
Cleanup
Carl-Hugo Mar 3, 2022
17a7be7
Add actions to StatorBuilder
Carl-Hugo Mar 3, 2022
b59e013
Register updaters
Carl-Hugo Mar 3, 2022
ce57103
Remove generic AddAction and AddUpdater methods
Carl-Hugo Mar 3, 2022
12e2569
Add a counter integration test
Carl-Hugo Mar 3, 2022
36644f7
Cleanup comments
Carl-Hugo Mar 3, 2022
53bd156
Extract DI from main project
Carl-Hugo Mar 3, 2022
504c9c2
AddState now add initialState properly
Carl-Hugo Mar 3, 2022
104b83b
Add ActionFilter to StatorBuilder
Carl-Hugo Mar 3, 2022
7461853
Add support for pipeline action filters
Carl-Hugo Mar 3, 2022
710b148
Statically fix the test program counter and experimental FluentValida…
Carl-Hugo Mar 3, 2022
11e8560
Make TypeScanner extension methods
Carl-Hugo Mar 3, 2022
3217317
Merge pull request #6 from ForEvolve/pipeline-rebuilding
Carl-Hugo Mar 3, 2022
6aab37f
Upgrade version to 1.0.0-ci.{height}
Carl-Hugo Mar 4, 2022
9b92a84
Remove StateR.Blazor.Experiments from the solution
Carl-Hugo Mar 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ indent_style = space

#Formatting - indentation

# Namespace
csharp_style_namespace_declarations = file_scoped:warning

#size of soft tabs (spaces)
indent_size = 4
#remove any whitespace characters preceding newline characters
Expand Down Expand Up @@ -234,9 +237,12 @@ dotnet_naming_style.interfaces_style.required_prefix = I
# This fix record class naming issues; to be targetted at records only when possible
dotnet_diagnostic.IDE1006.severity = suggestion

# IDE0057: Use range operator
dotnet_diagnostic.IDE0057.severity = none

# private fields and Async methods naming are optional for tests.
# this allows to declare `private sut` and name async test without the `Async` suffix.
[**/*.{Tests,IntegrationTests,FunctionalTests}/**.cs]
dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.async_methods_should_end_in_async.severity = suggestion
[**/*.*Tests/**.cs]
dotnet_naming_rule.private_fields_should_be_camel_case.severity = none
dotnet_naming_rule.async_methods_should_end_in_async.severity = none

17 changes: 9 additions & 8 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
- master

env:
DOTNET_2_VERSION: '2.1.x'
DOTNET_3_VERSION: '3.1.x'
DOTNET_5_VERSION: '5.0.x'
BUILD_CONFIGURATION: Release
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

Expand All @@ -24,10 +21,12 @@ jobs:
strategy:
fail-fast: false
matrix:
dotnet: ['5.0.x']
dotnet: ['6.0.x']

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
Expand All @@ -46,17 +45,19 @@ jobs:
strategy:
fail-fast: true
matrix:
dotnet: ['5.0.x']
dotnet: ['6.0.x']

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}

- uses: aarnott/nbgv@v0.3
- uses: dotnet/nbgv@master
with:
setAllVars: true

Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>preview</LangVersion>
<!-- <Nullable>enable</Nullable> -->
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
74 changes: 40 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Stator
# StateR

Stator is a simple, DI-oriented, Redux-inspired or Model-View-Update (MVU) **experiment** using C# 9.0.
It works well with Blazor and [MobileBlazorBindings](https://github.com/xamarin/MobileBlazorBindings),
StateR (sta·tor) is a simple DI-oriented Model-View-Update (MVU) **experiment** using C# 9+.

It works with Blazor and [MobileBlazorBindings](https://github.com/xamarin/MobileBlazorBindings),
including sharing states between the Xamarin part and the Blazor part of a hybrid mobile app.
It should also work with any other .NET stateful client model.

> As of 2021-04-08, the project does not support .NET Standard 2.0, only .NET 5+

This project uses:

- C# 9 record classes to ensure immutability and to simplify reducers.
- C# 9 record classes to ensure immutability and to simplify updaters.
- Dependency Injection to manage states (and everything else)

# How to install?
Expand All @@ -23,46 +24,46 @@ This project uses:

# Counter sample

The following snippet represent a feature, surrounding a counter, where you can `Increment`, `Decrement`,
and `Set` the value of the `Count` property of that `Counter.State`. The snippet also include the
The following snippet represents a feature surrounding a counter, where you can `Increment`, `Decrement`,
and `Set` the value of the `Count` property of that `Counter.State`. The snippet also includes the
`InitialState` of that counter.

```csharp
services
var appAssembly = typeof(App).Assembly;
builder.Services
.AddStateR(appAssembly)
.AddAsyncOperations() // Add support for Redux thunk-like helpers
.AddReduxDevTools() // Add support for Redux DevTools
.AddAsyncOperations() // [optional] Add support for Redux thunk-like helpers
.AddReduxDevTools() // [optional] Add support for Redux DevTools
.Apply()
;
```

```csharp
using StateR;

namespace BlazorMobileHybridExperiments.Features
namespace BlazorMobileHybridExperiments.Features;

public class Counter
{
public class Counter
{
public record State(int Count) : StateBase;
public record State(int Count) : StateBase;

public class InitialState : IInitialState<State>
{
public State Value => new State(0);
}
public class InitialState : IInitialState<State>
{
public State Value => new(0);
}

public record Increment : IAction;
public record Decrement : IAction;
public record Increment : IAction;
public record Decrement : IAction;

public class Reducers : IReducer<State, Increment>, IReducer<State, Decrement>
{
public State Reduce(State state, Increment action) => state with { Count = state.Count + 1 };
public State Reduce(State state, Decrement action) => state with { Count = state.Count - 1 };
}
public class Updaters : IUpdater<Increment, State>, IUpdater<Decrement, State>
{
public State Update(Increment action, State state) => state with { Count = state.Count + 1 };
public State Update(Decrement action, State state) => state with { Count = state.Count - 1 };
}
}
```

Then from a Blazor component that inherits from `StatorComponent`, we can dispatch those actions.
Then, from a Blazor component that inherits from `StatorComponent`, we can dispatch those actions.

```csharp
@page "/counter"
Expand All @@ -77,12 +78,19 @@ Then from a Blazor component that inherits from `StatorComponent`, we can dispat

> It is not needed to inherit from `StatorComponent`, a component (or any class) can manually subscribe to any `IState<T>`.

To make your life easier you can also add one or all of the follosing lines to the `_Imports.razor` file:

```
// Omitted using statements
@using StateR
@using StateR.Blazor
```

# The origin

I played around with a few other libraries and I was not 100% satisfied with how they did stuff.
So while playing around with MobileBlazorBindings and the new hybrid apps, I found that C# 9 records
were a great fit for this. I started experimenting with transforming immutable types (records) and
ended up creating this project.
I played around with a few other libraries, and I was not 100% satisfied with how they worked.
So while playing around with MobileBlazorBindings and the new hybrid apps, I found that C# 9 records classes were a great fit for this.
I started experimenting with transforming immutable types (records) and created this project.

## Origin of the name

Expand All @@ -104,14 +112,12 @@ After hearing about it for years, I read about it and found the concept brillian
This library is based on the concepts introduced by Redux, but .NET is not JavaScript and
.NET Core is built around Dependency Injection (DI), so I decided to take advantage of that.

There is no type and no real DI in JavaScript, so it make sense that the folks there did not take
that into account when they built Redux.
There is no type and no real DI in JavaScript, so it makes sense that the folks there did not take that into account when they built Redux.

# Redux DevTools

I based the Redux DevTools implementation on [Fluxor](https://github.com/mrpmorris/Fluxor/blob/master/Source/Fluxor.Blazor.Web.ReduxDevTools/ReduxDevToolsInterop.cs),
which is a similar project, that I used once.
That helped me lower the implementation time to connect Stator with Redux DevTools; thanks.
I based the Redux DevTools implementation on [Fluxor](https://github.com/mrpmorris/Fluxor/blob/master/Source/Fluxor.Blazor.Web.ReduxDevTools/ReduxDevToolsInterop.cs), which is a similar project that I used once.
That helped me lower the implementation time to connect StateR with Redux DevTools; thanks.

# To be continued

Expand Down
69 changes: 52 additions & 17 deletions StateR.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30509.190
# Visual Studio Version 17
VisualStudioVersion = 17.1.31911.260
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F0F6A2CA-0972-43BD-B777-B5656DFE20C3}"
EndProject
Expand All @@ -13,9 +13,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{372F8647-9
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StateR.Tests", "test\StateR.Tests\StateR.Tests.csproj", "{3276327A-63D9-4BEA-BBB8-D3AFF841CC67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateR.Experiments", "src\StateR.Experiments\StateR.Experiments.csproj", "{0EB20F7F-8AA1-48E2-9489-6975566469AF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StateR.Experiments", "src\StateR.Experiments\StateR.Experiments.csproj", "{0EB20F7F-8AA1-48E2-9489-6975566469AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateR.Blazor.Experiments", "src\StateR.Blazor.Experiments\StateR.Blazor.Experiments.csproj", "{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{22B777AC-AFAE-422A-B4CD-48C907251D9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CounterApp", "CounterApp", "{E72B8B55-3F7B-4EE2-955B-B5FAB222EBD9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CounterApp", "samples\CounterApp\CounterApp\CounterApp.csproj", "{99926EB0-84F9-4906-8F7E-4E1873A403EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CounterApp.Tests", "samples\CounterApp\CounterApp.Tests\CounterApp.Tests.csproj", "{FBDEBA94-7F63-4CB5-AC13-4D0874730316}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateR.Microsoft.Extensions.DependencyInjection", "src\StateR.Microsoft.Extensions.DependencyInjection\StateR.Microsoft.Extensions.DependencyInjection.csproj", "{5C432129-E637-4895-895D-1FDFDC61C049}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -75,18 +83,42 @@ Global
{0EB20F7F-8AA1-48E2-9489-6975566469AF}.Release|x64.Build.0 = Release|Any CPU
{0EB20F7F-8AA1-48E2-9489-6975566469AF}.Release|x86.ActiveCfg = Release|Any CPU
{0EB20F7F-8AA1-48E2-9489-6975566469AF}.Release|x86.Build.0 = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|x64.ActiveCfg = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|x64.Build.0 = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|x86.ActiveCfg = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Debug|x86.Build.0 = Debug|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|Any CPU.Build.0 = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|x64.ActiveCfg = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|x64.Build.0 = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|x86.ActiveCfg = Release|Any CPU
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D}.Release|x86.Build.0 = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|x64.Build.0 = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Debug|x86.Build.0 = Debug|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|Any CPU.Build.0 = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|x64.ActiveCfg = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|x64.Build.0 = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|x86.ActiveCfg = Release|Any CPU
{99926EB0-84F9-4906-8F7E-4E1873A403EB}.Release|x86.Build.0 = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|x64.ActiveCfg = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|x64.Build.0 = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|x86.ActiveCfg = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Debug|x86.Build.0 = Debug|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|Any CPU.Build.0 = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|x64.ActiveCfg = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|x64.Build.0 = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|x86.ActiveCfg = Release|Any CPU
{FBDEBA94-7F63-4CB5-AC13-4D0874730316}.Release|x86.Build.0 = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|x64.Build.0 = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Debug|x86.Build.0 = Debug|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|Any CPU.Build.0 = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|x64.ActiveCfg = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|x64.Build.0 = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|x86.ActiveCfg = Release|Any CPU
{5C432129-E637-4895-895D-1FDFDC61C049}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -96,7 +128,10 @@ Global
{EA4C22B6-78A9-481A-85BF-62FF1EA70F1B} = {F0F6A2CA-0972-43BD-B777-B5656DFE20C3}
{3276327A-63D9-4BEA-BBB8-D3AFF841CC67} = {372F8647-9F67-4176-B0C1-B0E5CAD87C9E}
{0EB20F7F-8AA1-48E2-9489-6975566469AF} = {F0F6A2CA-0972-43BD-B777-B5656DFE20C3}
{5B16AF66-5F00-4E5F-AAEF-DE2CF549E21D} = {F0F6A2CA-0972-43BD-B777-B5656DFE20C3}
{E72B8B55-3F7B-4EE2-955B-B5FAB222EBD9} = {22B777AC-AFAE-422A-B4CD-48C907251D9E}
{99926EB0-84F9-4906-8F7E-4E1873A403EB} = {E72B8B55-3F7B-4EE2-955B-B5FAB222EBD9}
{FBDEBA94-7F63-4CB5-AC13-4D0874730316} = {E72B8B55-3F7B-4EE2-955B-B5FAB222EBD9}
{5C432129-E637-4895-895D-1FDFDC61C049} = {F0F6A2CA-0972-43BD-B777-B5656DFE20C3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6ADD1933-C449-475E-9409-AD333C1C48A0}
Expand Down
14 changes: 14 additions & 0 deletions samples/CounterApp/CounterApp.Tests/AppTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Bunit;
using Xunit;

namespace CounterApp;

public class AppTest : TestContext
{
[Fact]
public void Should_render_markup()
{
var cut = RenderComponent<App>();
Assert.NotEmpty(cut.Markup);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>CounterApp</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="bunit" Version="1.4.15" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CounterApp\CounterApp.csproj" />
</ItemGroup>
</Project>
Loading