< Summary

Information
Class: FixedMathSharp.Assertions.FixedStructAssertions<T1, T2>
Assembly: FixedMathSharp.FluentAssertions
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp.FluentAssertions/FixedStructAssertions.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 48
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
.ctor(...)100%11100%
Be(...)100%11100%
NotBe(...)100%11100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp.FluentAssertions/FixedStructAssertions.cs

#LineLine coverage
 1//=======================================================================
 2// FixedStructAssertions.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using FluentAssertions;
 9using FluentAssertions.Execution;
 10using FluentAssertions.Numeric;
 11
 12namespace FixedMathSharp.Assertions;
 13
 14public abstract class FixedStructAssertions<TSubject, TAssertions>
 15    where TAssertions : FixedStructAssertions<TSubject, TAssertions>
 16{
 7917    protected FixedStructAssertions(TSubject value)
 18    {
 7919        Subject = value;
 7920        CurrentAssertionChain = AssertionChain.GetOrCreate();
 7921    }
 22
 23    protected TSubject Subject { get; }
 24
 25    protected AssertionChain CurrentAssertionChain { get; }
 26
 27    protected abstract string Identifier { get; }
 28
 29    public AndConstraint<TAssertions> Be(TSubject expected, string because = "", params object[] becauseArgs)
 30    {
 831        CurrentAssertionChain
 832            .ForCondition(Equals(Subject, expected))
 833            .BecauseOf(because, becauseArgs)
 834            .FailWith("Expected " + Identifier + " to equal {0}{reason}, but found {1}.", expected, Subject);
 35
 436        return new AndConstraint<TAssertions>((TAssertions)this);
 37    }
 38
 39    public AndConstraint<TAssertions> NotBe(TSubject unexpected, string because = "", params object[] becauseArgs)
 40    {
 641        CurrentAssertionChain
 642            .ForCondition(!Equals(Subject, unexpected))
 643            .BecauseOf(because, becauseArgs)
 644            .FailWith("Expected " + Identifier + " not to equal {0}{reason}, but found {1}.", unexpected, Subject);
 45
 346        return new AndConstraint<TAssertions>((TAssertions)this);
 47    }
 48}