Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Tests] Investigate how we can use Moq (or similar) in Unit Tests to fake WinRT APIs #3196

Closed
michael-hawker opened this issue Mar 26, 2020 · 3 comments
Labels
feature request 📬 A request for new changes to improve functionality help wanted Issues identified as good community contribution opportunities improvements ✨ testing 🏗️

Comments

@michael-hawker
Copy link
Member

Describe the problem this feature would solve

Discovered that we currently don't have any mocking setup in our Unit Tests in order to test things like the ConnectionHelper. Related to #2133 and #3165, though this is additional work not blocking the other issues/PRs.

Describe the solution

Need to find a mocking system that can mock WinRT APIs embedded within our helpers (not sure if this is possible, that's part of this investigation).

@michael-hawker michael-hawker added the feature request 📬 A request for new changes to improve functionality label Mar 26, 2020
@ghost
Copy link

ghost commented Mar 26, 2020

Thanks for submitting a new feature request! I've automatically added a vote 👍 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future!

@michael-hawker michael-hawker added this to the 6.1 milestone Mar 26, 2020
michael-hawker added a commit that referenced this issue Mar 26, 2020
More work is needed that we're not setup for in the toolkit yet to support these types of tests properly.
michael-hawker added a commit that referenced this issue Mar 31, 2020
More work is needed that we're not setup for in the toolkit yet to support these types of tests properly.
@michael-hawker michael-hawker added the help wanted Issues identified as good community contribution opportunities label Apr 2, 2020
@michael-hawker michael-hawker modified the milestones: 6.1, 7.0 May 6, 2020
@mrlacey
Copy link
Contributor

mrlacey commented Nov 10, 2020

After a few hours searching I'm not sure there's a supported mocking framework that will enable this.

TypeMock.Isolator may be a possibility but I'm not sure of the practicalities of adding a dependency on something with a paid license.

I'd instead look at creating a stub or adapter around the native calls that can then be adjusted as necessary for testing.

@michael-hawker
Copy link
Member Author

Thanks for taking a look @mrlacey. 🦙❤ Some libraries have open source licenses, it was hard to tell if they do or not.

I think with our new Unit Tests and soon to be Integration tests running in the CI that should cover the majority of the toolkit.

I'll see if any of our inbox app teams are doing anything in this space as well and have any suggestions.

@michael-hawker michael-hawker modified the milestones: 7.0, future Jan 5, 2021
@ghost ghost removed this from the future milestone Jan 5, 2021
@CommunityToolkit CommunityToolkit locked and limited conversation to collaborators Jul 29, 2022
@LalithaNadimpalli LalithaNadimpalli converted this issue into discussion #4664 Jul 29, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature request 📬 A request for new changes to improve functionality help wanted Issues identified as good community contribution opportunities improvements ✨ testing 🏗️
Projects
None yet
Development

No branches or pull requests

2 participants