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

Update dependency moq to v4.18.1 #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 7, 2020

Mend Renovate

This PR contains the following updates:

Package Type Update Change
moq nuget minor 4.12.0 -> 4.18.1

Release Notes

moq/moq4

v4.18.1

Fixed
  • Regression with lazy evaluation of It.Is predicates in setup expressions after updating from 4.13.1 to 4.16.1 (@​b3go, #​1217)
  • Regression with SetupProperty where Moq fails to match a property accessor implementation against its definition in an interface (@​Naxemar, #​1248)
  • Difference in behavior when mocking async method using .Result vs without (@​cyungmann, #​1253)

v4.18.0

New major version of DynamicProxy (you may get better performance!), so please update with care.

Changed
Fixed
  • Can't set up "private protected" properties (@​RobSiklos, #​1170)
  • Using [...] an old version of System.Net.Http which is vulnerable to "DoS", "Spoofing", "Privilege Escalation", "Authentication Bypass" and "Information Exposure" (@​sidseter, #​1219)
  • Failure when invoking a method with by-ref parameter & mockable return type on a mock with CallBase and DefaultValue.Mock configured (@​IanKemp, #​1249)

v4.17.2

Fixed

v4.17.1

Added
  • SetupSet, VerifySet methods for mock.Protected().As<>() (@​tonyhallett, #​1165)
  • New Throws method overloads that allow specifying a function with or without parameters, to provide an exception, for example .Throws(() => new InvalidOperationException())
    and Setup(x => x.GetFooAsync(It.IsAny<string>()).Result).Throws((string s) => new InvalidOperationException(s)). (@​adam-knights, #​1191)
Changed
  • Update package reference to Castle.Core (DynamicProxy) from version 4.4.0 to 4.4.1 (@​stakx, #​1233)
Fixed

v4.16.1

Added
Changed
  • Improved error message formatting of It.Is lambda expressions that capture local variables. (@​bfriesen, #​1140)
Fixed
  • AmbiguousMatchException raised when interface has property indexer besides property in VB. (@​mujdatdinc, #​1129)
  • Interface default methods are ignored (@​hahn-kev, #​972)
  • Callback validation too strict when setting up a task's .Result property (@​stakx, #​1132)
  • setup.Returns(InvocationFunc) wraps thrown exceptions in TargetInvocationException (@​stakx, #​1141)

v4.16.0

Added
  • Ability to directly set up the .Result of tasks and value tasks, which makes setup expressions more uniform by rendering dedicated async verbs like .ReturnsAsync, .ThrowsAsync, etc. unnecessary:

    -mock.Setup(x => x.GetFooAsync()).ReturnsAsync(foo)
    +mock.Setup(x => x.GetFooAsync().Result).Returns(foo)

    This is useful in places where there currently aren't any such async verbs at all:

    -Mock.Of<X>(x => x.GetFooAsync() == Task.FromResult(foo))
    +Mock.Of<X>(x => x.GetFooAsync().Result == foo)

    This also allows recursive setups / method chaining across async calls inside a single setup expression:

    -mock.Setup(x => x.GetFooAsync()).ReturnsAsync(Mock.Of<IFoo>(f => f.Bar == bar))
    +mock.Setup(x => x.GetFooAsync().Result.Bar).Returns(bar)

    or, with only Mock.Of:

    -Mock.Of<X>(x => x.GetFooAsync() == Task.FromResult(Mock.Of<IFoo>(f => f.Bar == bar)))
    +Mock.Of<X>(x => x.GetFooAsync().Result.Bar == bar)

    This should work in all principal setup methods (Mock.Of, mock.Setup…, mock.Verify…). Support in mock.Protected() and for custom awaitable types may be added in the future. (@​stakx, #​1126)

Changed
  • Attempts to mark conditionals setup as verifiable are once again allowed; it turns out that forbidding it (as was done in #​997 for version 4.14.0) is in fact a regression. (@​stakx, #​1121)
Fixed
  • Performance regression: Adding setups to a mock becomes slower with each setup (@​CeesKaas, #​1110)

  • Regression: mock.Verify[All] no longer marks invocations as verified if they were matched by conditional setups. (@​Lyra2108, #​1114)

v4.15.2

Changed

v4.15.1

Added
  • New method overloads for It.Is, It.IsIn, and It.IsNotIn that compare values using a custom IEqualityComparer<T> (@​weitzhandler, #​1064)
  • New properties ReturnValue and Exception on IInvocation to query recorded invocations return values or exceptions (@​MaStr11, #​921, #​1077)
  • Support for "nested" type matchers, i.e. type matchers that appear as part of a composite type (such as It.IsAnyType[] or Func<It.IsAnyType, bool>). Argument match expressions like It.IsAny<Func<It.IsAnyType, bool>>() should now work as expected, whereas they previously didn't. In this particular example, you should no longer need a workaround like (Func<It.IsAnyType, bool>)It.IsAny<object>() as originally suggested in #​918. (@​stakx, #​1092)
Changed
  • Event accessor calls (+= and -=) now get consistently recorded in Mock.Invocations. This previously wasn't the case for backwards compatibility with VerifyNoOtherCalls (which got implemented before it was possible to check them using Verify{Add,Remove}). You now need to explicitly verify expected calls to event accessors prior to VerifyNoOtherCalls. Verification of += and -= now works regardless of whether or not you set those up (which makes it consistent with how verification usually works). (@​80O, @​stakx, #​1058, #​1084)
  • Portable PDB (debugging symbols) are now embedded in the main library instead of being published as a separate NuGet symbols package (`.snupkg) (@​kzu, #​1098)
Fixed
  • SetupProperty fails if property getter and setter are not both defined in mocked type (@​stakx, #​1017)
  • Expression tree argument not matched when it contains a captured variable – evaluate all captures to their current values when comparing two expression trees (@​QTom01, #​1054)
  • Failure when parameterized Mock.Of<> is used in query comprehension from clause (@​stakx, #​982)

v4.14.7

Changed
  • Mocks created by DefaultValue.Mock now inherit SetupAllProperties from their "parent" mock (like it says in the XML documentation) (@​stakx, #​1074)
Fixed
  • Setup not triggered due to VB.NET transparently inserting superfluous type conversions into a setup expression (@​InteXX, #​1067)
  • Nested mocks created by Mock.Of<T>() no longer have their properties stubbed since version 4.14.0 (@​vruss, @​1071)
  • Verify fails for recursive setups not explicitly marked as Verifiable (@​killergege, #​1073)
  • Mock.Of<> fails for COM interop types that are annotated with a [CompilerGenerated] custom attribute (@​killergege, #​1072)

v4.14.6

Fixed
  • Regression since 4.14.0: setting nested non-overridable properties via Mock.Of (@​mariotee, #​1039)

v4.14.5

Fixed
  • Regression since version 4.11.0: VerifySet fails with NullReferenceException for write-only indexers (@​Epicycle23, #​1036)

v4.14.4

Fixed
  • Regression: NullReferenceException on subsequent setup if expression contains null reference (@​IanYates83, #​1031)

v4.14.3

Fixed

v4.14.2

Fixed

v4.14.1

Added
  • New SetupSequence verbs .PassAsync() and .ThrowsAsync(...) for async methods with void return type (@​fuzzybair, #​993)
Fixed
  • StackOverflowException on VerifyAll when mocked method returns mocked object (@​hotchkj, #​1012)

v4.14.0

Added
  • A mock's setups can now be inspected and individually verified via the new Mock.Setups collection and IInvocation.MatchingSetup property (@​stakx, #​984-#​987, #​989, #​995, #​999)

  • New .Protected().Setup and Protected().Verify method overloads to deal with generic methods (@​JmlSaul, #​967)

  • Two new public methods in Times: bool Validate(int count) and string ToString() (@​stakx, 975)

Changed
  • Attempts to mark conditionals setup as verifiable are now considered an error, since conditional setups are ignored during verification. Calls to .Verifiable() on conditional setups are no-ops and can be safely removed. (@​stakx, #​997)

  • When matching invocations against setups, captured variables nested inside expression trees are now evaluated. Their values likely matter more than their identities. (@​stakx, #​1000)

Fixed
  • Regression: Restored Capture.In use in mock.Verify(expression, ...) to extract arguments of previously recorded invocations. (@​vgriph, #​968; @​stakx, #​974)

  • Consistency: When mocking a class C whose constructor invokes one of its virtual members, Mock.Of<C>() now operates like new Mock<C>(): a record of such invocations is retained in the mock's Invocations collection (@​stakx, #​980)

  • After updating Moq from 4.10.1 to 4.11, mocking NHibernate session throws a System.NullReferenceException (@​ronenfe, #​955)

v4.13.1

Fixed
  • SetupAllProperties does not recognize property as read-write if only setter is overridden (@​stakx, #​886)

  • Regression: InvalidCastException caused by Moq erroneously reusing a cached auto-mocked (DefaultValue.Mock) return value for a different generic method instantiation (@​BrunoJuchli, #​932)

  • AmbiguousMatchException when setting up the property, that hides another one (@​ishatalkin, #​939)

  • ArgumentException ("Interface not found") when setting up object.ToString on an interface mock (@​vslynko, #​942)

  • Cannot "return" to original mocked type after downcasting with Mock.Get and then upcasting with mock.As<> (@​pjquirk, #​943)

  • params arrays in recursive setup expressions are matched by reference equality instead of by structural equality (@​danielcweber, #​946)

  • mock.SetupProperty throws NullReferenceException when called for partially overridden property (@​stakx, #​951)

v4.13.0

Changed
  • Improved error message that is supplied with ArgumentException thrown when Setup or Verify are called on a protected method if the method could not be found with both the name and compatible argument types specified (@​thomasfdm, #​852).

  • mock.Invocations.Clear() now removes traces of previous invocations more thoroughly by additionally resetting all setups to an "unmatched" state. (@​stakx, #​854)

  • Consistent Callback delegate validation regardless of whether or not Callback is preceded by a Returns: Validation for post-Returns callback delegates used to be very relaxed, but is now equally strict as in the pre-Returns case.) (@​stakx, #​876)

  • Subscription to mocked events used to be handled less strictly than subscription to regular CLI events. As with the latter, subscribing to mocked events now also requires all handlers to have the same delegate type. (@​stakx, #​891)

  • Moq will throw when it detects that an argument matcher will never match anything due to the presence of an implicit conversion operator. (@​michelcedric, #​897, #​898)

  • New algorithm for matching invoked methods against methods specified in setup/verification expressions. (@​stakx, #​904)

Added
  • Added support for setup and verification of the event handlers through Setup[Add|Remove] and Verify[Add|Remove|All] (@​lepijohnny, #​825)

  • Added support for lambda expressions while creating a mock through new Mock<SomeType>(() => new SomeType("a", "b")) and repository.Create<SomeType>(() => new SomeType("a", "b")). This makes the process of mocking a class without a parameterless constructor simpler (compiler syntax checker...). (@​frblondin, #​884)

  • Support for matching generic type arguments: mock.Setup(m => m.Method<It.IsAnyType>(...)). (@​stakx, #​908)

    The standard type matchers are:

    • It.IsAnyType — matches any type
    • It.IsSubtype<T> — matches T and proper subtypes of T
    • It.IsValueType — matches only value types

    You can create your own custom type matchers:

    [TypeMatcher]
    class Either<A, B> : ITypeMatcher
    {
        public bool Matches(Type type) => type == typeof(A) || type == typeof(B);
    }
  • In order to support type matchers (see bullet point above), some new overloads have been added to existing methods:

    • setup.Callback(new InvocationAction(invocation => ...)),
      setup.Returns(new InvocationFunc(invocation => ...)):

      The lambda specified in these new overloads will receive an IInvocation representing the current invocation from which type arguments as well as arguments can be discovered.

    • Match.Create<T>((object argument, Type parameterType) => ..., ...),
      It.Is<T>((object argument, Type parameterType) => ...):

      Used to create custom matchers that work with type matchers. When a type matcher is used for T, the argument received by the custom matchers is untyped (object), and its actual type (or rather the type of the parameter for which the argument was passed) is provided via an additional parameter parameterType. (@​stakx, #​908)

Fixed
  • Moq does not mock explicit interface implementation and protected virtual correctly. (@​oddbear, #​657)

  • Invocations.Clear() does not cause Verify to fail (@​jchessir, #​733)

  • Regression: SetupAllProperties can no longer set up properties whose names start with Item. (@​mattzink, #​870; @​kaan-kaya, #​869)

  • Regression: MockDefaultValueProvider will no longer attempt to set CallBase to true for mocks generated for delegates. (@​dammejed, #​874)

  • Verify throws TargetInvocationException instead of MockException when one of the recorded invocations was to an async method that threw. (@​Cufeadir, #​883)

  • Moq does not distinguish between distinct events if they have the same name (@​stakx, #​893)

  • Regression in 4.12.0: SetupAllProperties removes indexer setups. (@​stakx, #​901)

  • Parameter types are ignored when matching an invoked generic method against setups. (@​stakx, #​903)

  • For [Value]Task<object>, .ReturnsAsync(null) throws NullReferenceException instead of producing a completed task with result null (@​voroninp, #​909)


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from a team as a code owner May 7, 2020 18:58
@renovate renovate bot changed the title Update dependency moq to v4.14.1 Update dependency moq to v4.14.4 Jun 30, 2020
@renovate renovate bot changed the title Update dependency moq to v4.14.4 Update dependency moq to v4.14.5 Jul 5, 2020
@renovate renovate bot changed the title Update dependency moq to v4.14.5 Update dependency moq to v4.14.7 Oct 26, 2020
@renovate renovate bot changed the title Update dependency moq to v4.14.7 Update dependency moq to v4.15.2 Nov 28, 2020
@renovate renovate bot changed the title Update dependency moq to v4.15.2 Update dependency moq to v4.16.0 Jan 22, 2021
@renovate renovate bot changed the title Update dependency moq to v4.16.0 Update dependency moq to v4.16.1 Apr 26, 2021
@renovate renovate bot changed the title Update dependency moq to v4.16.1 Update dependency moq to v4.17.2 Mar 7, 2022
@renovate renovate bot changed the title Update dependency moq to v4.17.2 Update dependency moq to v4.18.0 May 15, 2022
@renovate renovate bot changed the title Update dependency moq to v4.18.0 Update dependency moq to v4.18.1 Jun 18, 2022
@renovate renovate bot force-pushed the renovate/moq-4.x branch 2 times, most recently from 0c63725 to c51850c Compare June 26, 2022 13:09
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.

None yet

0 participants