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

Introducing Moq Wrapper (Take 2) #5699

Merged
merged 71 commits into from
Jan 20, 2025
Merged

Conversation

retailcoder
Copy link
Member

This PR picks up where #4681 left off, fixing merge conflicts and adding support to Verify invocations on mocks.

This PR should be merged immediately (or shortly after) the version bump to v2.5.2.

ComMock.Verify is swallowing MockException and invoking AssertHandler static methods instead, to make a test pass or fail if the method is invoked.

…ot available and return a E_NOTIMPL instead.
…nd the mocking of VBA type is not functional yet due to an exception being thrown when marshaling a ITypeInfo to System.Type.
…Id() is just a System.__ComObject, by attempting to locate the type library, load it, and get the correct type for the specified type.
…nstance of same type by caching the types being mocked.
…ject now can expose the ComMocked interface and thus the Mock property. Remove the now unnecessary return of IUnknown for IDispatch (though we still do not get a IDispatch implementation).
…nterfaces, rather than in the default interface. This ensures that even if they used a older interface or whatever, the behavior remains the same. Moreover, we now can test using dynamic, which seems to have opposite expectations of how to bind to the member -- in COM, we bind to the default interface (e.g. IFileSystem3) but in dynamic, it binds to IFileSystem, which cause it to fail.

Also added more tests to cover some of mocking setups.
… types being generated for same COM interfaces.
…into a property for more consistency with Moq's syntax. Ensure that all derived interfaces are cached to aid in pseudo type-equivalence operations.
…s useless since the type equivalence is basically borked.
… the types, querying service for the type library, and obtaining a type to mock. Introduce CachedTypeService to manage the cache of types created via reflection/type library APIs to ensure equivalence of types for a session lifetime. See the comments in the class for details.
…nto MockComObjects

# Conflicts:
#	Rubberduck.Main/Root/RubberduckIoCInstaller.cs
…nto MockComObjects

# Conflicts:
#	Rubberduck.Main/Root/RubberduckIoCInstaller.cs
…nto MockComObjects

# Conflicts:
#	Rubberduck.VBEEditor/ComManagement/TypeLibs/TypeInfos.cs
…rovide unit tests. Bump to .NET 4.6.1 because ExpressiveReflection requires it.
…lection work. Add unit tests on the MoqReflection.
bclothier and others added 12 commits September 1, 2019 23:56
…to handle the Is expression and some tests. Includes forwarding the arguments to enable lambda to handle ref parameters because we cannot close a lambda with a ref parameter.
…ch got extra overloads so we need to be more specific. Fun times!
…the setup can be flawed if not executed in correct sequence. Wrote tests to assert the behaviors on how Setup works only specific values passed by ref.
…nsumers. RPS is used as a model, but subsequent PR will further encapsulate in order to only expose parser events to enable cache invalidation for type cache which must be outside the CW graph.
@retailcoder retailcoder changed the title [Re-]Introducing Moq Wrapper Introducing Moq Wrapper (Take 2) Mar 26, 2021
@MDoerner MDoerner added the PR-Status: Conflicting PR can't be merged as it stands, conflicts must be resolved by the author. label Sep 28, 2021
@Vogel612 Vogel612 added the up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky label May 7, 2022
@retailcoder retailcoder removed up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky PR-Status: Conflicting PR can't be merged as it stands, conflicts must be resolved by the author. labels Jan 20, 2025
@rubberduck-vba-releasebot
Copy link
Member

@rubberduck-vba-releasebot
Copy link
Member

@rubberduck-vba-releasebot
Copy link
Member

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.58%. Comparing base (5a02aa5) to head (1ec2081).
Report is 100 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #5699   +/-   ##
=======================================
  Coverage   97.58%   97.58%           
=======================================
  Files           4        4           
  Lines         413      413           
  Branches       28       28           
=======================================
  Hits          403      403           
  Misses          6        6           
  Partials        4        4           

@retailcoder retailcoder merged commit cc26274 into rubberduck-vba:next Jan 20, 2025
3 checks passed
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.

5 participants