Search code examples
c#.netentity-frameworkmoqjustmock

What is equivalent of moq.As in JustMock?


I am stuck to mock Entity Framework 6 asynchronous methods using JustMock. I searched in Google a lot but did not get any sufficient result. At last I got an example at testing with async queries but it is used Moq.

I am try to convert this into JustMock but i can not find anything like .As<TInterface>() in JustMock. Please tell me what is equivalent of moq.As in JustMock ?


Solution

  • Seems that there is no pure equivalent option on this framework to Moq.As<TInterface>.

    But, on Telerik's official documentation, multiple interface mocking is explained using as C# protected word.

    // Arrange
    var foo = Mock.Create<IFoo>();
    var iDisposable = foo as IDisposable; // <<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    

    Read this documentation and try the solution proposed to do so.