We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following works as expected in 4.0.10827 but in 4.1.1308.2321 the foo as IDisposable cast doesn't succeed.
foo as IDisposable
public interface IFoo { void Bar(); } [TestFixture] public class Tests { [Test] public void Test() { var mock = new Mock<IFoo>(); mock.Setup(x => x.Bar()); mock.As<IDisposable>().Setup(x => x.Dispose()); Action<IFoo> testMock = (IFoo foo) => { foo.Bar(); var disposable = foo as IDisposable; if (disposable != null) { disposable.Dispose(); } }; testMock(mock.Object); mock.VerifyAll(); }
The text was updated successfully, but these errors were encountered:
This was an unintended break from pull request #4.
I'm working on a fix. For the time being, if you move the .As to be the first line right after creating the mock, this test passes.
Will keep you posted.
Sorry, something went wrong.
Prevent early initialization of mock from checking for delegate mocks.
3ef9732
Fixes issue #54
Fixed and published on latest nuget: https://www.nuget.org/packages/moq
No branches or pull requests
The following works as expected in 4.0.10827 but in 4.1.1308.2321 the
foo as IDisposable
cast doesn't succeed.The text was updated successfully, but these errors were encountered: