'Mocking an Interface returns System.NotSupportedException

I am trying to mock a Interface method, but I am getting this error:

System.NotSupportedException : Unsupported expression: obj => obj.ReadInStreamAsync(It.IsAny<Stream>(), It.IsAny<string>(), It.IsAny<IList<string>>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>())
Extension methods (here: ComputerVisionClientExtensions.ReadInStreamAsync) may not be used in setup / verification expressions.

This is my code:

var computerVisionClientMock = new Mock<IComputerVisionClient>();

computerVisionClientMock.Setup(obj => obj.ReadInStreamAsync(
                                    It.IsAny<Stream>(),
                                    It.IsAny<string>(),
                                    It.IsAny<IList<string>>(),
                                    It.IsAny<string>(),
                                    It.IsAny<string>(),
                                    It.IsAny<CancellationToken>()
                                    ).Result).Callback<Stream, string, IList<string>, string, string, CancellationToken>((var0, var1, var2, var3, var4, var5) => { Thread.Sleep(2000); });

This is the Interface's definition:

IComputerVisionClient Interface



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source