< Summary

Information
Class: MyNet.UI.ViewModels.List.ListViewModel<T>
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/ViewModels/List/ListViewModel.cs
Tag: 323_28699572109
Line coverage
42%
Covered lines: 3
Uncovered lines: 4
Coverable lines: 7
Total lines: 69
Line coverage: 42.8%
Branch coverage
41%
Covered branches: 5
Total branches: 12
Branch coverage: 41.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)0%620%
.ctor(...)100%210%
.ctor(...)50%1010100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/ViewModels/List/ListViewModel.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ListViewModel.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Reactive.Concurrency;
 8using MyNet.Observable.Collections.Sources;
 9using MyNet.UI.ViewModels.List.Factories;
 10using MyNet.UI.ViewModels.List.Filtering;
 11using MyNet.UI.ViewModels.List.Grouping;
 12using MyNet.UI.ViewModels.List.Paging;
 13using MyNet.UI.ViewModels.List.Sorting;
 14
 15namespace MyNet.UI.ViewModels.List;
 16
 17/// <summary>
 18/// Represents a view model for a list of items of type T, providing functionalities for filtering, sorting, grouping, a
 19/// </summary>
 20/// <typeparam name="T">The type of items in the list.</typeparam>
 21/// <remarks>
 22/// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with the specified collection and optional vi
 23/// </remarks>
 24/// <param name="dataProvider">The collection of items to be managed by the view model.</param>
 25/// <param name="filters">Optional view model for managing filters.</param>
 26/// <param name="sorting">Optional view model for managing sorting.</param>
 27/// <param name="grouping">Optional view model for managing grouping.</param>
 28/// <param name="paging">Optional view model for managing paging.</param>
 29/// <param name="scheduler">Optional scheduler for managing concurrency.</param>
 30public class ListViewModel<T>(IListDataProvider<T> dataProvider,
 31    IFiltersViewModel<T>? filters = null,
 32    ISortingViewModel<T>? sorting = null,
 33    IGroupingViewModel<T>? grouping = null,
 34    IPagingViewModel? paging = null,
 3635    IScheduler? scheduler = null) : ListViewModelBase<T>(dataProvider, filters, sorting, grouping, paging, scheduler)
 36    where T : notnull
 37{
 38    /// <summary>
 39    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with optional options.
 40    /// </summary>
 41    /// <param name="source">The collection of items to be managed by the view model.</param>
 42    /// <param name="options">Optional list view model options.</param>
 43    public ListViewModel(SourceEngine<T> source, ListViewModelOptions<T>? options)
 044        : this(new ExtendedCollectionDataProvider<T>(new(source, options?.Scheduler)), options)
 45    {
 046    }
 47
 48    /// <summary>
 49    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class from a source engine.
 50    /// </summary>
 51    public ListViewModel(SourceEngine<T> source,
 52        IFiltersViewModel<T>? filters = null,
 53        ISortingViewModel<T>? sorting = null,
 54        IGroupingViewModel<T>? grouping = null,
 55        IPagingViewModel? paging = null,
 56        IScheduler? scheduler = null)
 057        : this(new ExtendedCollectionDataProvider<T>(new(source, scheduler)), filters, sorting, grouping, paging, schedu
 58    {
 059    }
 60
 61    /// <summary>
 62    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with optional options.
 63    /// </summary>
 64    public ListViewModel(IListDataProvider<T> dataProvider, ListViewModelOptions<T>? options)
 3665        : this(dataProvider, options?.Filters, options?.Sorting, options?.Grouping, options?.Paging, options?.Scheduler)
 66    {
 3667    }
 68}
 69