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
Declined
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 5