Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mass / MassFlow => TimeSpan operator. #1512

Conversation

andrewimcclement
Copy link

@andrewimcclement andrewimcclement commented Feb 5, 2025

This implements a missing operator (when compared with e.g. Volume, which has Volume / VolumeFlow => TimeSpan).

@lipchev
Copy link
Collaborator

lipchev commented Feb 5, 2025

@angularsen Note: we've already implemented this in v6 using the UnitRelations.json. Here's the most recent test for it:

        [Theory]
        [InlineData(10, MassUnit.Kilogram,
            5, MassFlowUnit.KilogramPerSecond,
            2, DurationUnit.Second)]
        public void Dividing_Mass_By_MassFlow_ReturnsDuration(double massValue, MassUnit massUnit, double massFlowValue,
            MassFlowUnit massFlowUnit, double expectedDurationValue, DurationUnit expectedDurationUnit)
        {
            var mass = new Mass(massValue, massUnit);
            var massFlow = new MassFlow(massFlowValue, massFlowUnit);
            var expectedDuration = new Duration(expectedDurationValue, expectedDurationUnit);

            Duration duration = mass / massFlow;

            Assert.Equal(expectedDuration, duration);
        }

@andrewimcclement
Copy link
Author

See https://github.com/angularsen/UnitsNet/blob/release/v6/Common/UnitRelations.json for the file @lipchev is referring to.
Great to see it's already implemented. Let me know if you want this PR abandoned or not.

@andrewimcclement
Copy link
Author

Abandoning on basis that it is implemented in v6.

@andrewimcclement andrewimcclement deleted the aim/add-mass-divides-mass-flow-operator branch February 14, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants