public void Time_ToUnit_Then_ResultShouldBeExpected(double value, double expected) { var time = new Time(value, selector => selector.Seconds); var result = time.ToUnit(selector => selector.Nano.Seconds); result.Should().BeApproximately(expected, "ns", TestHelper.DefaultAssertPrecision); }
public void Acceleration_Multiplication_Then_ResultShouldBeExpected(double lhs, double rhs, double expected) { var testee = new Acceleration(lhs, x => x.Kilo.Meters / x.Hours / x.Hours); var time = new Time(rhs, x => x.Hours); var result = testee * time; result.Should().Be(expected, "km/h"); }
public void Time_Division_ThenTimeIsRhs_Then_ResultShouldBeExpected() { const double Expected = 5000000; const double Value = 20000000; var time = new Time(4, units => units.Seconds); var result = Value / time; result.Should().Be(Expected, "Hz", UnitFormat.Default); }
public void Velocity_Division_When_RhsIsLength_Then_ResultShouldBeExpected( double lhs, double rhs, double expected) { var testee1 = new Velocity(lhs, selector => selector.Meters / selector.Seconds); var testee2 = new Time(rhs, x => x.Seconds); var result = testee1 / testee2; result.Should().Be(expected, "m/s" + Constants.Exponent2); }
public void Power_Multiplication_When_RhsIsSeconds_ThenResultShouldBeExpected( double lhs, double rhs, double expected) { var watt = new Power(lhs, units => units.Watts); var time = new Time(rhs, x => x.Seconds); var result = watt * time; result.Should().Be(expected, "J", UnitFormat.Default); }
private void WriteResult(Time lhs, Time rhs, int comparison) { if (comparison < 0) { this.output.WriteLine(lhs + " is less than " + rhs); } else if (comparison > 0) { this.output.WriteLine(lhs + " is greater than " + rhs); } else { this.output.WriteLine(lhs + " and " + rhs + " are equal"); } }
public void Distance_Division_When_RhsIsTime_Then_ResultShouldBeExpected( double lhs, double rhs, double expected) { var testee1 = new Distance(lhs, x => x.Meters); var testee2 = new Time(rhs, x => x.Seconds); var result = testee1 / testee2; result.Should().BeApproximately(expected, "m/s"); }