< Summary

Information
Class: MyNet.UI.Toasting.Filters.CompositeToastFilter
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Toasting/Filters/CompositeToastFilter.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 26
Line coverage: 100%
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
ShouldDisplay(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Toasting/Filters/CompositeToastFilter.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="CompositeToastFilter.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Collections.Generic;
 8using System.Linq;
 9using MyNet.UI.Notifications.Models;
 10
 11namespace MyNet.UI.Toasting.Filters;
 12
 13/// <summary>
 14/// Implements a toast filter that combines multiple filters, allowing a notification to be displayed only if it passes 
 15/// </summary>
 16/// <param name="filters">The collection of filters to be applied.</param>
 17public sealed class CompositeToastFilter(IEnumerable<IToastFilter> filters) : IToastFilter
 18{
 19    /// <summary>
 20    /// Determines whether the specified notification should be displayed based on the combined results of all filters. 
 21    /// </summary>
 22    /// <param name="notification">The notification to be evaluated.</param>
 23    /// <returns><c>true</c> if the notification should be displayed; otherwise, <c>false</c>.</returns>
 624    public bool ShouldDisplay(INotification notification) => filters.All(f => f.ShouldDisplay(notification));
 25}
 26