Mihail Vladov

Mocking DateTime.UtcNow fails in async test cases

On slow machines, sometimes arrangements lose their context and the expected mocked return value for DateTime.UtcNow fails.
Problem by Mihail Vladov Status: Approved Comments: 0 Last update: 2017-11-23T07:42:58 by Mihail Vladov
0
Kaloyan Kotorov

Different behaviour for different Arrange() overrides

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.
Problem by Kaloyan Kotorov Status: New Comments: 0 Attachments: 1 Last update: 2017-11-10T10:25:17 by Kaloyan Kotorov
0
Stacey Michaud

JustMock Profiler causes application hang on "new ReportDocument()"

I am using Visual Studio 2015, Crystal Reports 12.0.2. When running from Visual Studio in debug mode or not, the application hangs on the statement "new ReportDocument()". ReportDocument is a class defined in CrystalReports.

When I disabled the JustMock Profiler, this statement no longer hung.

Just FYI. Hopefully others will see this.
Feedback by Stacey Michaud Status: New Comments: 0 Last update: 2017-10-18T14:56:32 by Stacey Michaud
0
Kamen Ivanov
Team Member

Add integration with CodeRush

Feature Request by Kamen Ivanov Status: New Comments: 1 Last update: 2017-10-13T08:11:02 by Mihail Vladov
0
G M

Visual Studio Team Services integration

Our team is moving to VSTS and not having an official solution to run JustMock tests through their build system is a deal-breaker.
Feature Request by G M Status: Approved Comments: 0 Last update: 2017-10-12T12:28:33 by Mihail Vladov
0
Nick Apps

Allow simple mocking of fluent interfaces

If I define a fluent API, I might have an interface such as this:

public interface IRegistrar {

IRegistrar UsingThis(object someThing);

IRegistrar UsingThat<TThatThing>() }

If I create a mock of this using the default Behaviour.RecursiveLoose and make no arrangements, calls to the methods will return new mocks of the type, rather than the same instance that was called.

It would be nice to have a behaviour type that can return the same instance (in this case the mocked instance) without having to define a stub for each method call.

My code under test might look like:

IRegistrar reg;

reg

.UsingThis(new object())

.UsingThat<int>();

Currently, a test on the second call will fail if written against the mock assigned to 'reg'.
Feature Request by Nick Apps Status: New Comments: 0 Last update: 2017-10-02T10:01:24 by Nick Apps
0
Maxim Peshkov

AssemblyInitialize Mock.SetupStatic

I have logging class which are using everywhere.
I want to Mock this class for all tests. And i tried to use AssemblyInitialize but got problem. I have simulated this problem with JustMock.ElevatedExamples.AdvancedUsage examples:
1) Add BaseTest class
[TestClass]
public class BaseTest
{
[AssemblyInitialize()]
public static void AssemblyInit(TestContext context)
{
Mock.SetupStatic(typeof(Common1), StaticConstructor.Mocked);
// Arranging: When the static(Foo.FooProp_GET) property is called, it should return expected.
var fakeUsed = Mock.Create<LogWriter1>(Constructor.Mocked);
Mock.Arrange(() => Common1.Log).Returns(fakeUsed);
}

[AssemblyCleanup]
public static void Cleanup()
{
//clean up stuff here
}
}
public static class Common1
{
static Common1()
{

Log = new LogWriter1();

}

public static LogWriter1 Log { get; set; }

}

public class LogWriter1
{

}

2) When run test from VS - all ok
3) When run from command line it is not working. Show Message box "Process Starts Now".

SET JUSTMOCK_INSTANCE=1
SET COR_ENABLE_PROFILING=1
SET COR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0}
"C:\Program Files (x86)\Telerik\JustMock\Libraries\JustMockRunner.exe" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"D:\test\CSExamples\JustMock.ElevatedExamples\bin\Debug\JustMock.ElevatedExamples.dll"

How i can mock logger for all test? It is static public property.

I use MS Test + VS 2015.
Problem by Maxim Peshkov Status: New Comments: 0 Last update: 2017-04-19T08:19:08 by Maxim Peshkov
0
Kamen Ivanov
Team Member

Support for named parameters in Mock.Arrange

It would be good if we could use named parameters inside Mock.Arrange method.
Feature Request by Kamen Ivanov Status: New Comments: 0 Attachments: 1 Last update: 2017-04-07T07:00:10 by Kamen Ivanov
0
Sean Mackedie

Exception when mocking three or more layers deep with CreateLike<>

When using Mock.CreateLike<> we've found that trying to directly mock anything lower than two layers down on a concrete class (e.g. x => x.Layer1.Layer2.Property == "test") throws a NullReferenceException unless the profiler is enabled. It wasn't clear in the exception or the documentation relating to this method that the real issue was the profiler being disabled, and only by trial and error did we find the solution.
Problem by Sean Mackedie Status: New Comments: 0 Last update: 2017-03-22T07:40:19 by Sean Mackedie
0
Kamen Ivanov
Team Member

Tests fail when run via vstest.console but pass when run from VS2015

Tests fail when run with vstest.console.exe but pass when run from VS2015
Problem by Kamen Ivanov Status: New Comments: 0 Last update: 2017-03-07T15:02:28 by Kamen Ivanov
0
Displaying items 1 - 10 of 22