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

Make DefaultValue.Mock inherit property stubbing #1074

Merged
merged 3 commits into from Oct 13, 2020

Commits on Oct 13, 2020

  1. Add failing test caused by regression in cb6b71a

    Since that commit, inner mocks created by `Mock.Of<>()` no longer have
    their properties stubbed. `SetupAllProperties` is now only called for
    the root (outermost) mock. That's why nested properties can no longer
    be overridden simply by assigning to them.
    stakx committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    15dd8e9 View commit details
    Browse the repository at this point in the history
  2. Make DefaultValue.Mock inherit property stubbing

    The XML doc comment for `Mock<T>.SetupAllProperties()` states that:
    
    > If the mock's `DefaultValue` is set to `DefaultValue.Mock`, the
    > mocked default values will also get all properties setup recursively.
    
    But this does not actually happen! This commit changes the behavior of
    `DefaultValue.Mock` such that it does what it says on the tin.
    
    In theory, this could be a breaking change; let's see how many users
    have relied on behavior that contradicts the documentation.
    
    References:
    https://github.com/moq/moq4/blob/947c6a0aa1bbf265b5555ad0a84beb5bfc53b4e2/src/Moq/Mock.Generic.cs#L671-L674
    stakx committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    aea3f71 View commit details
    Browse the repository at this point in the history
  3. Update the changelog

    stakx committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    6abbc9a View commit details
    Browse the repository at this point in the history