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

Open
wants to merge 67 commits into
base: next
Choose a base branch
from

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 23 commits August 26, 2019 22:12
…nto MockComObjects

# Conflicts:
#	Rubberduck.CodeAnalysis/Rubberduck.CodeAnalysis.xml
#	Rubberduck.VBEEditor/ComManagement/TypeLibs/TypeLibs.cs

Also update the TypeLibWrapperProvider class, providing a TypeLibWrapperProviderLite version for the Main use without the CW's DI while keeping the TypeLib namespace largely private.
… was used but not as a parameter was used?!?
… to use IDispatch, which we can't return directly from managed code. However, because it's all dual, we can kind of return an IUnknown interface in its place.
…nto MockComObjects

# Conflicts:
#	Rubberduck.Main/Root/RubberduckIoCInstaller.cs
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Status: Conflicting PR can't be merged as it stands, conflicts must be resolved by the author. up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants