Refactor the IntToBoolConverter to use the BaseConverter#327
Refactor the IntToBoolConverter to use the BaseConverter#327TheCodeTraveler merged 10 commits intomainfrom
Conversation
|
Adding the |
There was a problem hiding this comment.
Thanks Shaun!
Could you also fix the Unit Test Method names? It looks like the current method names are leftover from a copy/paste of IndexToArrayConverter's tests:
IntToBoolConverter_Tests.IndexToArrayConverter->IntToBoolConverter_Tests.IntToBoolConverterIntToBoolConverter_Tests.IndexToArrayConverterBack->IntToBoolConverter_Tests.IntToBoolConverterBack
| Assert.Equal(result, expectedResult); | ||
| Assert.Equal(typedResult, expectedResult); |
There was a problem hiding this comment.
Let's swap these Assert.Equal parameters around.
It's kinda trivial, but when the Assert fails, it'll print "...Expected: [first parameter] Actual: [second parameter]" which can be confusing if the parameters are reversed
| Assert.Equal(result, expectedResult); | |
| Assert.Equal(typedResult, expectedResult); | |
| Assert.Equal(expectedResult, result); | |
| Assert.Equal(expectedResult, typedResult); |
| Assert.Equal(result, expectedResult); | ||
| Assert.Equal(typedResult, expectedResult); |
There was a problem hiding this comment.
Let's swap these Assert.Equal parameters around.
It's kinda trivial, but when the Assert fails, it'll print "...Expected: [first parameter] Actual: [second parameter]" which can be confusing if the parameters are reversed.
| Assert.Equal(result, expectedResult); | |
| Assert.Equal(typedResult, expectedResult); | |
| Assert.Equal(expectedResult, result); | |
| Assert.Equal(expectedResult, typedResult); |
| [InlineData("")] | ||
| [InlineData(null)] | ||
| public void InValidConverterValuesThrowArgumenException(object value) | ||
| public void InValidConverterValuesThrowArgumentException(object value) |
There was a problem hiding this comment.
Let's fix this small typo from a previous PR
| public void InValidConverterValuesThrowArgumentException(object value) | |
| public void InvalidConverterValuesThrowArgumentException(object value) |
| [InlineData("")] | ||
| [InlineData(null)] | ||
| public void InValidConverterBackValuesThrowArgumenException(object value) | ||
| public void InValidConverterBackValuesThrowArgumentException(object value) |
There was a problem hiding this comment.
Let's fix this small typo from a previous PR
| public void InValidConverterBackValuesThrowArgumentException(object value) | |
| public void InvalidConverterBackValuesThrowArgumentException(object value) |
|
@brminnick rhanks for the fix. I haven't removed the extensions around asserting the Excoetional conditions. What are your thoughts? |
|
Hey Shaun! I went ahead and pulled out the converter assert extension methods. I think it's best to keep the Unit Tests as simple/dumb as possible to make it easier for us to understand why unit tests are failing when writing future PRs. For example, when Vincent Hoogendoorn wrote the unit tests for the Markup library, he made them very complex and now it's tough to understand what a Unit Test is doing and, worse, to understand why a Unit Test is failing: https://github.com/CommunityToolkit/Maui.Markup/blob/main/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectExtensionsTests.cs |
|
No problem, I get that argument and missed you had removed them. I wanted to make sure before this went in 😃 |
Description of Change
Refactors the
IntToBoolConverterto use theBaseConverter.Linked Issues
n/a
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information