microsoft / SimpleStubs

*SimpleStubs* is a simple mocking framework that supports Universal Windows Platform (UWP), .NET Core and .NET framework. SimpleStubs is currently developed and maintained by Microsoft BigPark Studios in Vancouver.
Other
66 stars 29 forks source link

Cannot stub IAsyncOperation. #19

Closed prilling closed 6 years ago

prilling commented 7 years ago

When I add my own interface that inherits from IAsyncOperation, the generated code code compiles with the error "The name 'handler' does not exist in the current context".

From the following code that gets generated, the putter for Completed is trying to invoke with a parameter that does not exist (handler).

        global::Windows.Foundation.AsyncOperationCompletedHandler<T> global::Windows.Foundation.IAsyncOperation<T>.Completed
        {
            get
            {
                return _stubs.GetMethodStub<Completed_Get_Delegate>("get_Completed").Invoke();
            }

            set
            {
                _stubs.GetMethodStub<Completed_Set_Delegate>("put_Completed").Invoke(handler);
            }
        }
nehmebilal commented 7 years ago

For some reason SimpleStubs/Roslyn things that the setter argument in this case is "handler" instead of "value"! I'll look more into it.

nehmebilal commented 6 years ago

@prilling Can you try this again with 2.4.0?

nehmebilal commented 6 years ago

I am unable to reproduce this at the moment, closing.. please reopen if you can reproduce.