sharee.bike-App/TestShareeLib/Model/BikeInfo/DriveNS/BatteryNS/TestBattery.cs

50 lines
1.5 KiB
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using NUnit.Framework;
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
namespace TestShareeLib.Model.BikeInfo.DriveNS.BatteryNS
{
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestBattery
{
[Test]
public void TestSetCurrentChargePercent() => Assert.That(
new Battery.Builder { CurrentChargePercent = 20 }.Build().CurrentChargePercent,
Is.EqualTo(20.0));
[Test]
public void TestSetCurrentChargePercentOutOfRange() => Assert.That(
new Battery.Builder { CurrentChargePercent = 101 }.Build().CurrentChargePercent,
Is.NaN);
[Test]
public void TestSetCurrentChargeBars() => Assert.That(
new Battery.Builder { CurrentChargeBars = 21, MaxChargeBars = 22 }.Build().CurrentChargeBars,
Is.EqualTo(21));
[Test]
public void TestSetCurrentChargeBarsOutOfRange() => Assert.That(
new Battery.Builder { CurrentChargeBars = -1, MaxChargeBars = 22 }.Build().CurrentChargeBars,
Is.Null);
[Test]
public void TestSetMaxChargeBars() => Assert.That(
new Battery.Builder { MaxChargeBars = 23 }.Build().MaxChargeBars,
Is.EqualTo(23));
[Test]
public void TestSetMaxChargeBarsOutOfRange() => Assert.That(
new Battery.Builder { MaxChargeBars = -1 }.Build().MaxChargeBars,
Is.Null);
[Test]
public void TestSetCurrentChargeBarsNoMaxValueSet() => Assert.That(
new Battery.Builder { CurrentChargeBars = 21 }.Build().CurrentChargeBars,
Is.Null);
[Test]
public void TestSetCurrentChargeBars_CurrentValueTooLarge() => Assert.That(
new Battery.Builder { CurrentChargeBars = 25, MaxChargeBars = 22 }.Build().CurrentChargeBars,
Is.Null);
}
2022-08-30 15:42:25 +02:00
}