Skip to content

#51 -- Adds tests for ImageResourceConverter#196

Merged
TheCodeTraveler merged 18 commits intoCommunityToolkit:mainfrom
CalvinAllen:#61
Nov 22, 2021
Merged

#51 -- Adds tests for ImageResourceConverter#196
TheCodeTraveler merged 18 commits intoCommunityToolkit:mainfrom
CalvinAllen:#61

Conversation

@CalvinAllen
Copy link
Copy Markdown
Contributor

Fixes

Resolves the unit test portion of #61

Description

[Proposal] ImageResourceConverter #61

Detailed Solution

Unit tests to cover the ImageResouceConverter. This required mocking out the Application.Current object to allow assembly discovery to function properly for the Test project, which now has an image as an embedded resource.,

#51 -- Adds tests for ImageResourceConverter
@CalvinAllen
Copy link
Copy Markdown
Contributor Author

I can't tell if this is due to my changes or not - I don't think so?

Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good!

I recommend moving the initialization and disposal of Application.Current to the test class. Other tests may rely on Application, and we don't want to break them.

I also went ahead and added the [NotNullIfNotNull] attribute to ImageResourceConverter.Convert to make your casting a bit easier + cleaner in ImageResourceConverter_Tests.ImageResourceConverter.

Comment thread src/CommunityToolkit.Maui.UnitTests/BaseTest.cs Outdated
Comment thread src/CommunityToolkit.Maui.UnitTests/BaseTest.cs Outdated
TheCodeTraveler and others added 3 commits November 22, 2021 22:18
#61 -- Refactor Application usage into test class, out of base class, per PR review.
Comment thread src/CommunityToolkit.Maui.UnitTests/Converters/ImageResourceConverter_Tests.cs Outdated
Comment thread src/CommunityToolkit.Maui.UnitTests/Converters/ImageResourceConverter_Tests.cs Outdated
#61 -- Move duplicated methods to BaseTest
Comment thread src/CommunityToolkit.Maui.UnitTests/BaseTest.cs Outdated
@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

TheCodeTraveler commented Nov 22, 2021

image

👀 Don't forget to click the Update Branch button here too

Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

Thanks @CalvinAllen!!

@TheCodeTraveler TheCodeTraveler marked this pull request as ready for review November 22, 2021 21:53
@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) November 22, 2021 21:53
Comment thread src/CommunityToolkit.Maui.UnitTests/xunit.runner.json
@TheCodeTraveler TheCodeTraveler merged commit 8b8796b into CommunityToolkit:main Nov 22, 2021
@CalvinAllen CalvinAllen deleted the #61 branch November 22, 2021 22:12
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants