Completed
Last Updated: 07 Oct 2013 11:12 by Chris Eargle
Created by: Chris Eargle
Comments: 0
Type: Feature Request
1
"After struggling with TypeMock for an hour, I gave #JustMock a try and it works great! Thanks."

https://twitter.com/JohnFecko/status/316211813761040384 
Completed
Last Updated: 07 Oct 2013 11:05 by Micah
Created by: Micah
Comments: 0
Type: Feature Request
1
Given:
public abstract class Foo
{
}

[Test]
public void test_foo()
{
    Mock.Create<Foo>(Behavior.Strict, Constructor.Mocked);
}

An exception is thrown at runtime saying "Abstract Type is not Accessible for Inheritance".  This doesn't lead you to the actual problem which is that I accidentally swapped the Behavior and the Constructor in the parameter order.  The same problem can occur if you attempt to call a constructor on an abstract object with the wrong number of parameters like so:
public abstract class Foo
{
    public Foo(int a, string b)
    {
    }
}

[Test]
public void test_foo()
{
    Mock.Create<Foo>(1, "foo", null);
}

This seems to be a problem with the compiler choosing the wrong overload to call and unfortunately there aren't a lot of solutions without changing the Create API.  Perhaps having an alternative to Mock.Create that is more explicit that we can use to avoid typos leading to exceptions that are difficult to make sense of or a hint in the exception message that suggests what the root cause might be?
Completed
Last Updated: 27 Aug 2013 06:39 by Omer
Created by: Omer
Comments: 0
Type: Bug Report
0
Hi there, I'm a developer on OzCode, a Visual Studio extension ( www.oz-code.com ).

We've received some complaints from customers that OzCode is incompatible with JustCode. I installed JustMock, and saw that when Visual Studio starts up, JustMock it seems to be causing a crash in a child process that OzCode spawns off of devenv.exe, which is called 'BugAidMetadataLoader.exe':

The exception in this process is:

Additional information: Could not load type 'Telerik.JustMock.Profiler' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I would guess that JustMock is unintentionally causing the process to be loaded with a CLR Profiler attached and injecting code into it, and the injected code causes the crash.

Could you please provide some advice on how to avoid this, or possibly provide a fix?

Thank you very much,
 - Omer Raviv, OzCode
Completed
Last Updated: 04 Jun 2013 06:40 by Keith
I use NCrunch, a popular test runner. But it cannot seem to activate the JustMock profiler properly. So tests that require use of the JustMock profiler do not work properly.
Completed
Last Updated: 23 May 2013 13:14 by Kaloyan
ADMIN
Created by: Mihail
Comments: 1
Type: Feature Request
3
JustMock should be able to mock private methods in Silverlight.
Completed
Last Updated: 21 May 2013 13:39 by Kaloyan
Should be able to arrange against non-public methods taking ref or out arguments as parameter.
Completed
Last Updated: 17 May 2013 12:44 by Jakub
When I try to invoke method from intercepted class in multi-thread test sometimes I get following exception:
System.ArgumentException
Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList(IEnumerable`1 source)
   at Telerik.JustMock.Weaver.ContainerContext.InstanceIdentifier.GetUniqueId(Object target)
   at Telerik.JustMock.Weaver.ContainerContext.Get(Type targetType, MethodBase methodInfo, Object target)
   at Telerik.JustMock.Weaver.ContainerContext.Get(MethodBase methodBase, Object target)
   at Telerik.JustMock.Weaver.Interceptors.WeaverInterceptor.OnInvocation(IInvocation invocation)
   at Telerik.JustMock.Weaver.Interceptors.WeaverInterceptor.Telerik.JustMock.Weaver.Interceptors.Abstraction.IWeaverInterceptor.Intercept(IInvocation invocation)
   at TestClass_Interceptor_620e5e80fe0c4d738f7ef291ea50ea2a.Intercept(TestClass, ref Boolean)
   at ExceptionExample.TestClass.ExecuteSomething() in Test.cs: line 174
   at ExceptionExample.RunMethod() in Test.cs: line 199
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


Sample class that generates exception:

[TestFixture]
public class ExceptionExample
{
	static ExceptionExample()
	{
		Mock.Initialize<TestClass>();
	}

	public class TestClass
	{
		public void ExecuteSomething()
		{
			int y = 0;
			for (int i = 0; i < 100; i++)
				y += i;
		}
	}

	[Test]
	public void MethodName()
	{
		List<Thread> l = new List<Thread>();

		for (int i = 0; i < 6; i++)
		{
			Thread t = new Thread(RunMethod);
			t.Start();
			l.Add(t);
		}

		l.ForEach(th => th.Join());
	}

	private void RunMethod()
	{
		for (int i = 0; i < 10000; i++)
		{
			TestClass tc1 = new TestClass();
			tc1.ExecuteSomething();
		}
	}
}
Completed
Last Updated: 17 May 2013 12:29 by Stefan
ADMIN
Created by: Mihail
Comments: 0
Type: Feature Request
1
By default JustMock matches the mock parameters via Object.ReferenceEquals(...). It would be nice to match the mock parameters via Object.Equals(...) as well.

http://www.telerik.com/community/forums/justmock/general-discussions/parameter-matching.aspx
Rejected
Last Updated: 17 May 2013 12:29 by Mohd
ADMIN
Created by: Mihail
Comments: 1
Type: Bug Report
1
Since JustMock Q1 2013 Mock.DoNotUseProfiler() is marked as an obsolete method and I cannot compile my test project. Revert it back.
Completed
Last Updated: 17 May 2013 12:23 by Kaloyan
Created by: Kaloyan
Comments: 0
Type: Feature Request
0
I'd like to intercept a call to a generic method similar to:

public  class MyClass
{
    public void MyMethod<T>()
    {
        //
    }
}

Now I want to arrange a MyClass instance so I can assert that the method has been call only once for an specific type and never for any other type. I'm tryig to do something similar to:

var service = Mock.Create<MyClass>();
Mock.Arrange(() => service.MyMethod<T>()).OccursNever();

So I can assert the generic method is never called.
Completed
Last Updated: 17 May 2013 12:23 by David
I'm getting this argument exception:
System.ArgumentException : The type or method has 3 generic parameter(s), but 2 generic argument(s) were provided. A generic argument must be provided for each generic parameter.
   at System.RuntimeType.SanityCheckGenericArguments(RuntimeType[] genericArguments, RuntimeType[] genericParamters)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
   at .š.(Type ‹, MethodBase „†, BindingFlags )
   at .š.(Type ‚, MethodBase „†)
   at ”.“.Create(Object š, MethodInfo ›, Boolean ’)
   at ..(˜ )
   at ..(Expression`1 )
   at Telerik.JustMock.Mock..Ž( )
   at ..—[,—]( , Func`2 )
   at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)

Heres an example of a failing test:

        [Test]
        public void GenericTestCanMockTwoGenericMethods()
        {
            var mocked = Mock.Create<GenericTest>();
            IEnumerable<EVENT_CODE> n = null;
            Mock.Arrange(() => mocked.Query<EVENT_CODE, ALARM_CODE>(Arg.AnyString, Arg.IsAny<object>())).Returns(n).MustBeCalled();
        }

        public interface GenericTest
        {
            IEnumerable<T1> Query<T1, T2>(string arg1, params object[] args);

            IEnumerable<T1> Query<T1, T2, T3>(string arg1, params object[] args);
        }
Completed
Last Updated: 14 May 2013 12:13 by ADMIN
Created by: Philip Japikse
Comments: 1
Type: Feature Request
0
As a developer, I want to be able to automock classes that have concrete classes injected
Completed
Last Updated: 14 May 2013 12:12 by ADMIN
Please allow automocking support for classes with multiple constructors. This is important for projects not using DI containers but using dependency injection. A classic example is ASP.NET MVC and ASP.NET Web API where standard routing requires a constructor with no parameters. When using DI via constructors but without containers, the overloaded ctor specifies services/repositories and the default ctor passes the default services/repositories.
Completed
Last Updated: 22 Nov 2012 15:00 by Philip Japikse
If I have a constructor like this: public Foo(IAccount fromAccount, IAccount toAccount) { //code }, I need to be able to distinguish between the two accounts when automocking.
container.Arrange<IAccount>() won't work.  Perhaps container.Arrange<IAccount>[0] would. 
Completed
Last Updated: 21 Nov 2012 00:37 by Philip Japikse
Created by: Philip Japikse
Comments: 0
Type: Feature Request
0
Currently, I can only assert all when automocking.  It would be nice to be able to assert individually.  container.Assert<IAccount>().  If we implement my other item (http://feedback.telerik.com/Project/105/Feedback/Details/850-distinguish-between-automocked-items-when-multiple-of-the-same-are-in-the-constru) then it would be container.Assert<IAccount>[0] if there were more than one IAccount in the constructor.
1 2 3 4