< Summary

Information
Class: MyNet.UI.ViewModels.List.Filtering.Catalog.FilterDefinition<T1, T2>
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/ViewModels/List/Filtering/Catalog/FilterDefinition.cs
Tag: 323_28699572109
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 45
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_FilterType()100%210%
Create()100%210%

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="FilterDefinition.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using MyNet.Observable;
 9
 10namespace MyNet.UI.ViewModels.List.Filtering.Catalog;
 11
 12/// <summary>
 13/// Represents a concrete implementation of <see cref="IFilterDefinition{T}"/> that defines how to create a filter condi
 14/// </summary>
 15/// <param name="key">The unique key identifying the filter.</param>
 16/// <param name="displayName">The provider for the display name of the filter.</param>
 17/// <param name="factory">The factory function to create instances of the filter condition view model.</param>
 18/// <typeparam name="T">The type of items to be filtered.</typeparam>
 19/// <typeparam name="TFilter">The type of the filter condition view model.</typeparam>
 20public sealed class FilterDefinition<T, TFilter>(string key, IObservableValue<string> displayName, Func<TFilter> factory
 21    : IFilterDefinition<T>
 22    where TFilter : IFilterConditionViewModel<T>
 23{
 24    /// <summary>
 25    /// Gets the unique key that identifies this filter definition. This key is used to distinguish different filter def
 26    /// </summary>
 027    public string Key { get; } = key;
 28
 29    /// <summary>
 30    /// Gets the provider for the display name of this filter definition. This provider is used to obtain the display na
 31    /// </summary>
 032    public IObservableValue<string> DisplayName { get; } = displayName;
 33
 34    /// <summary>
 35    /// Gets the type of the filter condition view model. This property returns the type of the filter condition view mo
 36    /// </summary>
 037    public Type FilterType => typeof(TFilter);
 38
 39    /// <summary>
 40    /// Creates an instance of the filter condition view model using the factory function provided. This method allows c
 41    /// </summary>
 42    /// <returns>A new instance of the filter condition view model.</returns>
 043    public IFilterConditionViewModel<T> Create() => factory();
 44}
 45