You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write unit tests around a class which uses the recurly client, however due to the internal constructors and internal methods, I cannot mock or shim the classes.
Example:
var fakeList = new ShimRecurlyList<Plan>();
Error:
Example:
var fakeList = new Mock<RecurlyList<Plan>>();
ShimPlans.List = () => fakeList.Object;
Exception:
System.ArgumentException
HResult=0x80070057
Message=Type to mock must be an interface, a delegate, or a non-sealed, non-static class.
Source=Moq
StackTrace:
at Moq.CastleProxyFactory.CreateProxy(Type mockType, IInterceptor interceptor, Type[] interfaces, Object[] arguments)
at Moq.Mock`1.InitializeInstance()
at Moq.Mock`1.OnGetObject()
at Moq.Mock.get_Object()
at Moq.Mock`1.get_Object()
at KeySystems.SubscriptionServiceTests.RecurlySubscriptionServiceTests.<>c__DisplayClass0_0.<AddPlans>b__1() in D:\KeySystems-CustomerService\KeySystems.SubscriptionServiceTests\RecurlySubscriptionServiceTests.cs:line 57
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
TypeLoadException: Method 'ReadXml' in type 'Castle.Proxies.RecurlyList`1Proxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
How should I test my code that relies on the recurly client as a dependency please?
The text was updated successfully, but these errors were encountered:
Hi @CraigComeOnThisNameCantBeTaken. Sorry for the delay here and thanks for your question. We'll make sure to get back to you after the long holiday weekend. Thanks for your patience.
Hi @CraigComeOnThisNameCantBeTaken. Sorry for the delay here and thanks for your question. We'll make sure to get back to you after the long holiday weekend. Thanks for your patience.
I am trying to write unit tests around a class which uses the recurly client, however due to the internal constructors and internal methods, I cannot mock or shim the classes.
Example:
var fakeList = new ShimRecurlyList<Plan>();
Error:
Example:
Exception:
How should I test my code that relies on the recurly client as a dependency please?
The text was updated successfully, but these errors were encountered: