Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
I've figured this out on my own. The key part I was missing properly defining the .DoInstead to invoke the c
Here's what I put together.
01.
IAsyncResult asyncResult = Mock.Create<IAsyncResult>();
02.
var ldapConnection = Mock.Create<LdapConnection>();
03.
Mock.Arrange(
04.
() =>
05.
ldapConnection.BeginSendRequest(Arg.IsAny<DirectoryRequest>(), Arg.IsAny<PartialResultProcessing>(),
06.
Arg.IsAny<AsyncCallback>(),
null
))
07.
.DoInstead<DirectoryRequest, PartialResultProcessing, AsyncCallback,
object
>((dr, prp, cb, os) => { cb.Invoke(asyncResult); })
08.
.Returns(asyncResult);
09.
Mock.Arrange(() => ldapConnection.EndSendRequest(asyncResult)).Returns(searchResponse);