< Summary

Information
Class: MyNet.UI.ViewModels.List.ListViewModel<T>
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.UI/ViewModels/List/ListViewModel.cs
Tag: 342_31701152804
Line coverage
42%
Covered lines: 3
Uncovered lines: 4
Coverable lines: 7
Total lines: 70
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/5aaaab311aa14541478b9e402357d98b657a23e4/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;
 9using MyNet.Observable.Collections.Sources;
 10using MyNet.UI.ViewModels.List.Factories;
 11using MyNet.UI.ViewModels.List.Filtering;
 12using MyNet.UI.ViewModels.List.Grouping;
 13using MyNet.UI.ViewModels.List.Paging;
 14using MyNet.UI.ViewModels.List.Sorting;
 15
 16namespace MyNet.UI.ViewModels.List;
 17
 18/// <summary>
 19/// Represents a view model for a list of items of type T, providing functionalities for filtering, sorting, grouping, a
 20/// </summary>
 21/// <typeparam name="T">The type of items in the list.</typeparam>
 22/// <remarks>
 23/// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with the specified collection and optional vi
 24/// </remarks>
 25/// <param name="dataProvider">The collection of items to be managed by the view model.</param>
 26/// <param name="filters">Optional view model for managing filters.</param>
 27/// <param name="sorting">Optional view model for managing sorting.</param>
 28/// <param name="grouping">Optional view model for managing grouping.</param>
 29/// <param name="paging">Optional view model for managing paging.</param>
 30/// <param name="scheduler">Optional scheduler for managing concurrency.</param>
 31public class ListViewModel<T>(IListDataProvider<T> dataProvider,
 32    IFiltersViewModel<T>? filters = null,
 33    ISortingViewModel<T>? sorting = null,
 34    IGroupingViewModel<T>? grouping = null,
 35    IPagingViewModel? paging = null,
 3636    IScheduler? scheduler = null) : ListViewModelBase<T>(dataProvider, filters, sorting, grouping, paging, scheduler)
 37    where T : notnull
 38{
 39    /// <summary>
 40    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with optional options.
 41    /// </summary>
 42    /// <param name="source">The collection of items to be managed by the view model.</param>
 43    /// <param name="options">Optional list view model options.</param>
 44    public ListViewModel(SourceEngine<T> source, ListViewModelOptions<T>? options)
 045        : this(new ExtendedCollectionDataProvider<T>(new ExtendedCollection<T>(source, options?.Scheduler)), options)
 46    {
 047    }
 48
 49    /// <summary>
 50    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class from a source engine.
 51    /// </summary>
 52    public ListViewModel(SourceEngine<T> source,
 53        IFiltersViewModel<T>? filters = null,
 54        ISortingViewModel<T>? sorting = null,
 55        IGroupingViewModel<T>? grouping = null,
 56        IPagingViewModel? paging = null,
 57        IScheduler? scheduler = null)
 058        : this(new ExtendedCollectionDataProvider<T>(new ExtendedCollection<T>(source, scheduler)), filters, sorting, gr
 59    {
 060    }
 61
 62    /// <summary>
 63    /// Initializes a new instance of the <see cref="ListViewModel{T}"/> class with optional options.
 64    /// </summary>
 65    public ListViewModel(IListDataProvider<T> dataProvider, ListViewModelOptions<T>? options)
 3666        : this(dataProvider, options?.Filters, options?.Sorting, options?.Grouping, options?.Paging, options?.Scheduler)
 67    {
 3668    }
 69}
 70