Open
Conversation
--- updated-dependencies: - dependency-name: Moq dependency-version: 4.20.72 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated Moq from 4.11.0 to 4.20.72.
Release notes
Sourced from Moq's releases.
4.20.72
What's Changed
🔨 Other
Full Changelog: devlooped/moq@v4.20.71...v4.20.72
4.20.71
What's Changed
🔨 Other
New Contributors
Full Changelog: devlooped/moq@v4.20.70...v4.20.71
4.20.70
What's Changed
🔨 Other
New Contributors
Full Changelog: devlooped/moq@v4.20.69...v4.20.70
4.20.69
Let's make it more memorable when Moq became "safe" again.
What's Changed
4.20.2
What's Changed
🐛 Fixed bugs
Full Changelog: moq/moq.spikes@v4.20.1...v4.20.2
4.20.1
What's Changed
✨ Implemented enhancements
Full Changelog: moq/moq.spikes@v4.20.0...v4.20.1
4.20.0
What's Changed
✨ Implemented enhancements
setup.Verifiable(Times times, [string failMessage])method by @stakx in https://github.com/moq/moq/pull/1319🔨 Other
Mock<T>.RaiseAsyncby @stakx in https://github.com/moq/moq/pull/1313ThrowsAsyncfor non-genericValueTaskby @johnthcall in https://github.com/moq/moq/pull/1235mock.Protected().Verify<T>()method overload by @stakx in https://github.com/moq/moq/pull/1325New Contributors
Full Changelog: moq/moq.spikes@v4.18.4...v4.20.0
4.20.0-rc
What's Changed
🔨 Other
Full Changelog: moq/moq.spikes@v4.20.0-beta...v4.20.0-rc
4.20.0-beta
What's Changed
✨ Implemented enhancements
setup.Verifiable(Times times, [string failMessage])method by @stakx in https://github.com/moq/moq/pull/1319🔨 Other
Mock<T>.RaiseAsyncby @stakx in https://github.com/moq/moq/pull/1313ThrowsAsyncfor non-genericValueTaskby @johnthcall in https://github.com/moq/moq/pull/1235mock.Protected().Verify<T>()method overload by @stakx in https://github.com/moq/moq/pull/1325New Contributors
Full Changelog: moq/moq.spikes@v4.18.4...v4.20.0-beta
4.20.0-alpha
What's Changed
✨ Implemented enhancements
setup.Verifiable(Times times, [string failMessage])method by @stakx in https://github.com/moq/moq/pull/1319🔨 Other
Mock<T>.RaiseAsyncby @stakx in https://github.com/moq/moq/pull/1313ThrowsAsyncfor non-genericValueTaskby @johnthcall in https://github.com/moq/moq/pull/1235mock.Protected().Verify<T>()method overload by @stakx in https://github.com/moq/moq/pull/1325New Contributors
Full Changelog: moq/moq.spikes@v4.18.4...v4.20.0-alpha
4.18.4
Changed
Castle.Core(DynamicProxy) from version 5.1.0 to 5.1.1 (@stakx, #1317)4.18.3
Fixed
SetupAllPropertiescrashes when invoked on aMock<T>subclass (@mo-russo, #1278)4.18.2
Changed
Castle.Core(DynamicProxy) from version 5.0.0 to 5.1.0 (@stakx, #1275)System.Threading.Tasks.Extensionsfornetstandard2.1andnet6.0(@tibel, #1274)Fixed
.Raises()with redeclared event (@howcheng, #1175)MissingMethodExceptionwhen mocking interface with sealed default implementation (@pjquirk, #1209)TypeLoadExceptionon mock when a record has a base record on .NET 6 (@tgrieger-sf, #1273)4.18.1
Fixed
It.Ispredicates in setup expressions after updating from 4.13.1 to 4.16.1 (@b3go, #1217)SetupPropertywhere Moq fails to match a property accessor implementation against its definition in an interface (@Naxemar, #1248).Resultvs without (@cyungmann, #1253)4.18.0
New major version of DynamicProxy (you may get better performance!), so please update with care.
Changed
Castle.Core(DynamicProxy) from version 4.4.1 to 5.0.0 (@stakx, #1257)net45tonet462net6.0TFMFixed
System.Net.Httpwhich is vulnerable to "DoS", "Spoofing", "Privilege Escalation", "Authentication Bypass" and "Information Exposure" (@sidseter, #1219)CallBaseandDefaultValue.Mockconfigured (@IanKemp, #1249)4.17.2
Fixed
4.17.1
Added
SetupSet,VerifySetmethods formock.Protected().As<>()(@tonyhallett, #1165)Throwsmethod 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
Castle.Core(DynamicProxy) from version 4.4.0 to 4.4.1 (@stakx, #1233)Fixed
_forIt.IsAny<>()(@adamfk, #1199)mock.Protected()setup methods fail when argument is of typeExpression(@tonyhallett, #1189)Protected().SetupSet()...VerifySet(@tonyhallett, #1186)mock.Protected().As<>()(@tonyhallett, #1185)Verifyfail when it should not (@evilc0, #1225)Mock.Of(@stakx, #1066)SetupAllPropertiescauses mocks to become race-prone (@estrizhok, #1231)4.16.1
Added
CallBasecan now be used with interface methods that have a default interface implementation. It will call the most specific override. (@stakx, #1130)Changed
It.Islambda expressions that capture local variables. (@bfriesen, #1140)Fixed
AmbiguousMatchExceptionraised when interface has property indexer besides property in VB. (@mujdatdinc, #1129).Resultproperty (@stakx, #1132)setup.Returns(InvocationFunc)wraps thrown exceptions inTargetInvocationException(@stakx, #1141)4.16.0
Added
Ability to directly set up the
.Resultof tasks and value tasks, which makes setup expressions more uniform by rendering dedicated async verbs like.ReturnsAsync,.ThrowsAsync, etc. unnecessary:This is useful in places where there currently aren't any such async verbs at all:
This also allows recursive setups / method chaining across async calls inside a single setup expression:
or, with only
Mock.Of:This should work in all principal setup methods (
Mock.Of,mock.Setup…,mock.Verify…). Support inmock.Protected()and for custom awaitable types may be added in the future. (@stakx, #1126)Changed
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)4.15.2
Changed
System.Threading.Tasks.Extensionsdependency to version 4.5.4 (@JeffAshton, #1108)4.15.1
Added
It.Is,It.IsIn, andIt.IsNotInthat compare values using a customIEqualityComparer<T>(@weitzhandler, #1064)ReturnValueandExceptiononIInvocationto query recorded invocations return values or exceptions (@MaStr11, #921, #1077)It.IsAnyType[]orFunc<It.IsAnyType, bool>). Argument match expressions likeIt.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
+=and-=) now get consistently recorded inMock.Invocations. This previously wasn't the case for backwards compatibility withVerifyNoOtherCalls(which got implemented before it was possible to check them usingVerify{Add,Remove}). You now need to explicitly verify expected calls to event accessors prior toVerifyNoOtherCalls. 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)Fixed
SetupPropertyfails if property getter and setter are not both defined in mocked type (@stakx, #1017)Mock.Of<>is used in query comprehensionfromclause (@stakx, #982)4.14.7
Changed
DefaultValue.Mocknow inheritSetupAllPropertiesfrom their "parent" mock (like it says in the XML documentation) (@stakx, #1074)Fixed
Mock.Of<T>()no longer have their properties stubbed since version 4.14.0 (@vruss, @1071)Verifyfails for recursive setups not explicitly marked asVerifiable(@killergege, #1073)Mock.Of<>fails for COM interop types that are annotated with a[CompilerGenerated]custom attribute (@killergege, #1072)4.14.6
Fixed
Mock.Of(@mariotee, #1039)4.14.5
Fixed
VerifySetfails withNullReferenceExceptionfor write-only indexers (@Epicycle23, #1036)4.14.4
Fixed
NullReferenceExceptionon subsequent setup if expression contains null reference (@IanYates83, #1031)4.14.3
Fixed
Verifybehavior change usingDefaultValue.Mock(@DesrosiersC, #1024)4.14.2
Fixed
Verifybehavior change usingDefaultValue.Mock(@DesrosiersC, #1024)4.14.1
Added
SetupSequenceverbs.PassAsync()and.ThrowsAsync(...)for async methods withvoidreturn type (@fuzzybair, #993)Fixed
StackOverflowExceptiononVerifyAllwhen mocked method returns mocked object (@hotchkj, #1012)4.14.0
Added
A mock's setups can now be inspected and individually verified via the new
Mock.Setupscollection andIInvocation.MatchingSetupproperty (@stakx, #984-#987, #989, #995, #999)New
.Protected().SetupandProtected().Verifymethod overloads to deal with generic methods (@JmlSaul, #967)Two new public methods in
Times:bool Validate(int count)andstring 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.Inuse inmock.Verify(expression, ...)to extract arguments of previously recorded invocations. (@vgriph, #968; @stakx, #974)Consistency: When mocking a class
Cwhose constructor invokes one of its virtual members,Mock.Of<C>()now operates likenew Mock<C>(): a record of such invocations is retained in the mock'sInvocationscollection (@stakx, #980)After updating Moq from 4.10.1 to 4.11, mocking NHibernate session throws a
System.NullReferenceException(@ronenfe, #955)4.13.1
Fixed
SetupAllPropertiesdoes not recognize property as read-write if only setter is overridden (@stakx, #886)Regression:
InvalidCastExceptioncaused 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 upobject.ToStringon an interface mock (@vslynko, #942)Cannot "return" to original mocked type after downcasting with
Mock.Getand then upcasting withmock.As<>(@pjquirk, #943)paramsarrays in recursive setup expressions are matched by reference equality instead of by structural equality (@danielcweber, #946)mock.SetupPropertythrowsNullReferenceExceptionwhen called for partially overridden property (@stakx, #951)4.13.0
Changed
Improved error message that is supplied with
ArgumentExceptionthrown whenSetuporVerifyare 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
Callbackdelegate validation regardless of whether or notCallbackis preceded by aReturns: Validation for post-Returnscallback delegates used to be very relaxed, but is now equally strict as in the pre-Returnscase.) (@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]andVerify[Add|Remove|All](@lepijohnny, #825)Added support for lambda expressions while creating a mock through
new Mock<SomeType>(() => new SomeType("a", "b"))andrepository.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 typeIt.IsSubtype<T>— matchesTand proper subtypes ofTIt.IsValueType— matches only value typesYou can create your own custom type matchers:
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
IInvocationrepresenting 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, theargumentreceived 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 parameterparameterType. (@stakx, #908)... (truncated)
4.12.0
Changed
Mock.Of<T>andmock.SetupAllProperties()as the latter now performs property setups just-in-time, instead of as an ahead-of-time batch operation. (@vanashimko, #826).Returns(…)nor.CallBase()no longer returndefault(T)for loose mocks, but a value that is consistent with the mock'sCallBaseandDefaultValue[Provider]settings. (@stakx, #849)Added
sequenceSetup.ReturnsAsync(Func<T>)(@stakx, #841)Mock.Of,Mocks.Of,mockRepository.Of, andmockRepository.OneOfthat accept aMockBehaviorparameter. (@stakx, #842)Fixed
Callbackto a mock breaks async tests (@marcin-chwedczuk-meow, #702)mock.SetupAllProperties()now setups write-only properties for strict mocks, so that accessing such properties will not throw anymore. (@vanashimko, #836)mock.SetupAllProperties()andMock.Of<T>fail due to inaccessible property accessors (@Mexe13, #845)VerifyNoOtherCallscauses stack overflow when mock setup returns the mocked object (@bash, #846)Capture.In()no longer captures arguments when other setup arguments do not match (@ocoanet, #844).CaptureMatchno longer invokes the capture callback when other setup arguments do not match (@ocoanet, #844).Commits viewable in compare view.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)