コード例 #1
0
        public void Velocity_Division_Then_ResultShouldBeExpected(double lhs, double rhs, double expected)
        {
            var testee1 = new Velocity(lhs, selector => selector.Meters / selector.Seconds);
            var testee2 = new Velocity(rhs, selector => selector.Meters / selector.Seconds);

            var result = testee1 / testee2;

            result.Should().Be(expected);
        }
コード例 #2
0
        public void Velocity_ToString_When_UnitModeIsSpecified_Then_ResultShouldBeExpected(
            UnitFormat unitFormat,
            string expected)
        {
            var testee = new Velocity(1, x => x.Kilo.Meters / x.Hours);

            var result = testee.ToString(unitFormat);

            result.Should().Be(expected);
        }
コード例 #3
0
        public void Velocity_ToUnit_When_ConvertingFromKiloMeterPerHourToMeterPerSecond_Then_ResultShouldBeAsExpected(
            double velocity,
            double expected)
        {
            var testee = new Velocity(velocity, x => x.Kilo.Meters / x.Hours);

            var result = testee.ToUnit(x => x.Meters / x.Seconds);

            result.Should().BeApproximately(expected, "m/s", TestHelper.DefaultAssertPrecision);
        }
コード例 #4
0
        public void Velocity_ToUnit_When_UnitsAreDifferent_Then_ResultShouldBeAsExpected(
            double velocity,
            double expected)
        {
            var testee = new Velocity(velocity, x => x.Miles / x.Hours);

            var result = testee.ToUnit(x => x.Kilo.Meters / x.Hours);

            result.Should().BeApproximately(expected, "km/h", TestHelper.DefaultAssertPrecision);
        }
コード例 #5
0
        public void Velocity_Division_When_DividingWithAnyNumber_Then_ResultShouldBeExpected(
            double lhs,
            double rhs,
            double expected)
        {
            var testee = new Velocity(lhs, selector => selector.Meters / selector.Seconds);

            var result = testee / rhs;

            result.Should().Be(expected, "m/s");
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public void Distance_Division_When_RhsIsVelocity_Then_ResultShouldBeExpected(
            double lhs,
            double rhs,
            double expected)
        {
            var testee1 = new Distance(lhs, x => x.Meters);
            var testee2 = new Velocity(rhs, selector => selector.Meters / selector.Seconds);

            var result = testee1 / testee2;

            result.Should().BeApproximately(expected, "s");
        }
コード例 #8
0
        public void Distance_Division_When_RhsIsVelocityAndPrefixesAreDifferent_Then_ResultShouldBeExpected(
            double lhs,
            double rhs,
            double expected)
        {
            var testee1 = new Distance(lhs, x => x.Centi.Meters);
            var testee2 = new Velocity(rhs, selector => selector.Meters / selector.Seconds);

            var result = testee1 / testee2;

            result.Should().BeApproximately(expected, "s", TestHelper.DefaultAssertPrecision);
        }