An open API service indexing awesome lists of open source software.

https://github.com/verifytests/verify.communitytoolkit.mvvm

Extends Verify to allow verification of CommunityToolkit.Mvvm.
https://github.com/verifytests/verify.communitytoolkit.mvvm

Last synced: 8 months ago
JSON representation

Extends Verify to allow verification of CommunityToolkit.Mvvm.

Awesome Lists containing this project

README

          

# Verify.CommunityToolkit.Mvvm

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/sb66s1o8w1t9ba70?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-communitytoolkit-mvvm)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.CommunityToolkit.Mvvm.svg)](https://www.nuget.org/packages/Verify.CommunityToolkit.Mvvm/)

Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of [CommunityToolkit.Mvvm](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/).

## Sponsors

### Entity Framework Extensions

[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.CommunityToolkit.Mvvm) is a major sponsor and is proud to contribute to the development this project.

[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.CommunityToolkit.Mvvm/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.CommunityToolkit.Mvvm)

## NuGet

* https://nuget.org/packages/Verify.CommunityToolkit.Mvvm

## Usage


```cs
[ModuleInitializer]
public static void Initialize() =>
VerifyCommunityToolkitMvvm.Initialize();
```
snippet source | anchor

### RelayCommand


```cs
[Fact]
public Task RelayCommand()
{
var content = new RelayCommand(ActionMethod, CanExecuteMethod);
return Verify(content);
}
```
snippet source | anchor

Results in:


```txt
{
Execute: Tests.ActionMethod,
CanExecute: Tests.CanExecuteMethod
}
```
snippet source | anchor

### AsyncRelayCommand


```cs
[Fact]
public Task AsyncRelayCommand()
{
var content = new AsyncRelayCommand(ActionMethodAsync, CanExecuteMethod);
return Verify(content);
}
```
snippet source | anchor

Results in:


```txt
{
Execute: Tests.ActionMethodAsync,
CanExecute: Tests.CanExecuteMethod
}
```
snippet source | anchor