Skip to content

UnitAbbreviationsCache: GetDefaultAbbreviation should throw when no abbreviations are mapped#1539

Merged
angularsen merged 1 commit into
angularsen:masterfrom
lipchev:fix-empty-abbreviations
Apr 11, 2025
Merged

UnitAbbreviationsCache: GetDefaultAbbreviation should throw when no abbreviations are mapped#1539
angularsen merged 1 commit into
angularsen:masterfrom
lipchev:fix-empty-abbreviations

Conversation

@lipchev

@lipchev lipchev commented Apr 11, 2025

Copy link
Copy Markdown
Collaborator

fixes the first part of #1509

  • UnitAbbreviationsCache: GetDefaultAbbreviation should throw when no abbreviations are mapped
  • Volume: added the missing abbreviation mappings

… abbreviations are mapped

- Volume: added the missing abbreviation mappings
@lipchev

lipchev commented Apr 11, 2025

Copy link
Copy Markdown
Collaborator Author

This is missing a test for the unhappy path:

        [Fact]
        public void GetDefaultAbbreviation_ForUnitWithoutAbbreviations_ThrowsInvalidOperationException()
        {
            Assert.Throws<InvalidOperationException>(() => new UnitAbbreviationsCache([HowMuch.Info]).GetDefaultAbbreviation(HowMuchUnit.AShitTon));
        }

But this doesn't work just yet.. I'll add it later, probably after the little refactoring I got planned for the the UnitAbbreviationsCacheTests.

@angularsen angularsen merged commit c02b189 into angularsen:master Apr 11, 2025
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.

2 participants