using NUnit.Framework;
using Telerik.JustMock;
namespace Example
{
public class MyClass
{
public MyClass(int a = 5) { }
}
[TestFixture]
public class TestMyClass
{
[Test]
public void test_MyClass()
{
Mock.Create<MyClass>(Behavior.CallOriginal);
}
}
}
Telerik.JustMock.MockException : Can not instantiate proxy of class: Example.MyClass.
Could not find a parameterless constructor.
at Telerik.JustMock.Core.MocksRepository.Create(Type type, MockCreationSettings settings)
at Telerik.JustMock.MockBuilder.Create(MocksRepository repository, Type type, Object[] constructorArgs, Nullable`1 behavior, Type[] additionalMockedInterfaces, Nullable`1 mockConstructorCall, IEnumerable`1 additionalProxyTypeAttributes, List`1 supplementaryBehaviors, List`1 fallbackBehaviors, List`1 mixins)
at Telerik.JustMock.Mock.<>c__DisplayClass5b`1.<Create>b__5a()
at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction)
at Telerik.JustMock.Mock.Create[T](Behavior behavior, Object[] args)
at Example.TestMyClass.test_MyClass() in c:\users\micah\Documents\Source\Test\Test\Class1.cs:line 17#0
This appears to be related to the recent fix for "Improve exception message for Mock.Create". Without Behavior.CallOriginal it works. Supplying a parameter also works.