< Summary

Information
Class: MyNet.Primitives.Conversion.MassConverter
Assembly: MyNet.Primitives
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Primitives/Conversion/MassConverter.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 25
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
Convert(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Primitives/Conversion/MassConverter.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="MassConverter.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.Primitives.Conversion;
 10
 11/// <summary>
 12/// Provides conversion between different mass units. The conversion is based on powers of 10, where each unit is 10 tim
 13/// </summary>
 14public sealed class MassConverter : IUnitConverter<MassUnit>
 15{
 16    /// <summary>
 17    /// Converts a mass value from one unit to another. The conversion is performed by multiplying the input value by 10
 18    /// </summary>
 19    /// <param name="value">The mass value to convert.</param>
 20    /// <param name="from">The unit of the input value.</param>
 21    /// <param name="to">The unit to convert the value to.</param>
 22    /// <returns>The converted mass value.</returns>
 1223    public double Convert(double value, MassUnit from, MassUnit to) => value * Math.Pow(10, from - to);
 24}
 25