In Development
Last Updated: 23 Aug 2019 09:28 by ADMIN

The CallMethod of the PrivateAccessor is using reflection to invoke the required method. When an exception is thrown inside that method it will be wrapped by the reflection in a TargetInvocationException which is received in the test method.

Instead of the TargetInvocationException, throw the original exception.

Approved
Last Updated: 22 Aug 2019 06:21 by ADMIN
Created by: Mihail
Comments: 0
Type: Feature Request
1
Implement support for executing JustMock tests on Linux
Approved
Last Updated: 19 Aug 2019 15:28 by ADMIN
The JutMock task for Azure Pipeline is missing the option to execute the tests with Visual Studio 2019. Check the attached screenshot.
In Development
Last Updated: 16 Aug 2019 07:03 by ADMIN
The execution of JustMock tests stoped working in Visual Studio. The exact version is 16.2.1. The error message is: "The profiler must be enabled to mock, arrange or execute the specified target."
In Development
Last Updated: 25 Jul 2019 10:12 by ADMIN
The debugger arrowhead pointer is not positioned to the correct execution line when debugging .Net Core. Stepping the code line by line advances the yellow arrowhead pointer based on the initial offset/messed position. When the arrowhead leaves the method the remaining lines are executed at once.
Approved
Last Updated: 09 Jul 2019 11:14 by ADMIN
The JustMock profiler should be added to the commercial NuGet package distributed from the Telerik private NuGet server.
Approved
Last Updated: 18 Jun 2019 14:21 by ADMIN
The scenario includes two async tests executed synchronously. The first test doesn't have an await task call and in some random runs fails to call Mock.Reset. This messes the mocked objects of the second async test.
Completed
Last Updated: 18 Jun 2019 10:06 by ADMIN

Values from already mocked methods are not taken into account when initializing a static constructor from the Telerik.JustMock.PrivateAccessor class.

Here is an example: PrivateAccessor.ForType(typeof(Foo)).SetField("someStringField", "stringvalue");

A workaround is to call the: Mock.Intercept(typeof(Foo)); before calling the PrivateAccessor.

Completed
Last Updated: 18 Jun 2019 08:43 by ADMIN
There is a different behaviour when mocking the same method using the following two Arrange overrides:

public static FuncExpectation<TResult> Arrange<TResult>(Expression<Func<TResult>> expression);
public static FuncExpectation<TResult> Arrange<T, TResult>(T obj, Func<T, TResult> func);

Repro project attached. Steps to reproduce:
1. Open attached solution
2. In Tests.cs, run JustMockArrangeQueryableTest - it passes
3. Run JustMockArrangeQueryableTest2 - it fails with a invalid cast exception on the Residents collection.
Completed
Last Updated: 18 Jun 2019 08:37 by ADMIN
The integration between JustMock and dotCover stopped working with R2 2019. The result when code coverage is started is that all tests remain in pending state and does not finish while the CPU is idle.
Completed
Last Updated: 18 Jun 2019 08:34 by ADMIN
I have a .Net Core solution and want to see the code coverage in VS 2019. However, when I run the tests with code coverage, I get the error message, that the profiler is not enabled, although it is enabled. The test is green without code coverage (and with enabled profiler). It is also green and the coverage is displayed with JustMock commented out and the profiler disabled.
Approved
Last Updated: 05 Jun 2019 11:59 by ADMIN

Hi I have encountered what I think is a bug.

I would expected the following unit test to pass. It does not.

The example is distilled from a more complex case.

Is it not supported to have other threads create mocks?

[Fact] public async Task Fails() { var iTask = Task.Run(() => Mock.Create<I>()); var i = await iTask; EA expectedArgs = new EA(); EA receivedArgs = null; i.Done += (sender, ea) => receivedArgs = ea;

i.Raise(x => x.Done += null, expectedArgs); Assert.Equal(expectedArgs, receivedArgs); } public class EA : EventArgs { } public interface I { event EventHandler<EA> Done; }


Approved
Last Updated: 30 May 2019 08:38 by ADMIN

Let's have the following class and unit test:

public delegate Task<int> SomeDelegate();

public class Class1
{
    public async Task<int> ExecuteAsync(SomeDelegate next)
    {
        Task<int> task1 = next.Invoke();
        int int1 = await DoSomeStuff();
        int int2 = await task1;
        return int1 + int2;
    }

    private async Task<int> DoSomeStuff()
    {
        await Task.Delay(100);
        return 1;
    }
}

[TestMethod]
public async Task TestMethod1()
{
    // Arrange
    SomeDelegate next = Mock.Create<SomeDelegate>();
    next.Arrange(n => n.Invoke()).TaskResult(2).OccursOnce();
    // Act
    int sum = await new Class1().ExecuteAsync(next);

    // Assert
    Mock.Assert(next);
    Assert.AreEqual(3, sum);
}

JustMock public API lacks of convenient way to assert that particular task has been awaited. Potential workaround involves some "insider knowledge" that awaiting a Task internally results in a calls to some of its members.

Approved
Last Updated: 27 May 2019 15:18 by ADMIN
Mocking a method that is not used in the test execution logic could lead to unwanted recursive mocking behavior for the rest of the methods in the class. 
The unwanted behavior could later result in an exception if the affected methods are called during the arrangement of another method.
Completed
Last Updated: 20 May 2019 09:44 by ADMIN
2019.R1 JustMock Test project templates need to be updated to support .Net Core, currently they are targeting just .Net Framework (see attached screen shot).
Completed
Last Updated: 20 May 2019 09:32 by ADMIN
Mocking an async calls alse triggers hidden mocking of the return type. Depending of the type it might cause unexpected behavior or exception.
Completed
Last Updated: 20 May 2019 09:31 by ADMIN
Created by: Marcel
Comments: 1
Type: Bug Report
0
Basically calling Mock.Reset at the end of the method is not safe.
It seems like the the way JustMock iterates over an IEnumerable is not correct.
Log:
2019-01-25T09:23:53.9254819Z Warning: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
2019-01-25T09:23:53.9254819Z    at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
2019-01-25T09:23:53.9254819Z    at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.MocksRepository.CopyConfigurationFromParent()
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.MocksRepository.Reset()
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RepositoryOperationsStrongRef.RetireRepository(Object key, MocksRepository repo)
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindRepositoryInOps(RepositoryOperationsBase entryOps, Object entryKey)
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RetireRepository()
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.Context.MockingContext.RetireRepository()
2019-01-25T09:23:53.9254819Z    at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
2019-01-25T09:23:53.9254819Z    at Sap.Tests.<MyTests_DoAsync_ReturnTrue>d__26.MoveNext() in E:\Builds\_work\9\s\Tests\MyTests.cs:line 476
2019-01-25T09:23:53.9254819Z    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9254819Z    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
2019-01-25T09:23:53.9410972Z    at System.Threading.ThreadPoolWorkQueue.Dispatch()
2019-01-25T09:23:53.9410972Z    at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
2019-01-25T09:23:53.9410972Z    at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.MocksRepository.CopyConfigurationFromParent()
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.MocksRepository.Reset()
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RepositoryOperationsStrongRef.RetireRepository(Object key, MocksRepository repo)
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindRepositoryInOps(RepositoryOperationsBase entryOps, Object entryKey)
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.RetireRepository()
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.Context.MockingContext.RetireRepository()
2019-01-25T09:23:53.9410972Z    at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
2019-01-25T09:23:53.9410972Z    at Sap.Tests.<MyTests_DoAsync_ReturnTrue>d__26.MoveNext() in E:\Builds\_work\9\s\Tests\MyTests.cs:line 476
2019-01-25T09:23:53.9410972Z    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
2019-01-25T09:23:53.9410972Z    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
2019-01-25T09:23:53.9410972Z    at System.Threading.ThreadPoolWorkQueue.Dispatch()
Completed
Last Updated: 20 May 2019 09:26 by ADMIN
A class property get wrongly mocked when used as parameter for arranging other class methods. The following sample demonstrates the scenario:

class Foo
{
	public string Prop{ get; set; }

	public void Bar(string val)
	{
	}
}

[TestMethod]
public void Sample()
{
	var sut = Mock.Create<Foo>(Behavior.CallOriginal);

	Mock.Arrange(() => sut.Bar(sut.Prop)).DoNothing();
}
In Development
Last Updated: 03 Apr 2019 07:43 by ADMIN
Docker is a container acting like an isolated environment. Research how the JustMock profiler can be registered into such container.
Hosted VSTS should work on the same principle. Research how the registry could be accessed through VSTS extension or other tools.
1 2 3 4 5