Kamen Ivanov
Team Member

Add integration with CodeRush

Feature Request by Kamen Ivanov Status: New Comments: 1 Last update: 2017-06-26T23:55:45 by Josh Vote
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
Michele Sinesi

justmock

In Visual Studio 2015 Pro justmock generates this error error MSB6006: "vbc.exe" To function properly you need to uninstall VS2015 justmock.

Bye
Problem by Michele Sinesi Status: New Comments: 3 Last update: 2016-08-02T22:08:40 by Jeremy Simmons
0
Brian Stanton

resharper 10

Resharper 10 code coverage have tests failing when arrange to have JustMock to return values from methods called under test. Perhaps one tool too many manipulating .NET objects behind-the-scenes at a time?
Problem by Brian Stanton Status: New Comments: 1 Last update: 2015-12-18T15:35:53 by Brian Stanton
0
William Cowell

Mocking WinRT using helper methods to create mocks

My team and I have spotted some odd behaviour with the latest version of JustMock (2015.3.929.5) when targeting a Windows Store app.

If we create a mock for an object in a helper method, the mock fails when making assertions for calls to the mock.

The following code illustrates the issue:

[TestMethod]
public void ThisWillFail()
{
var subject = CreateSubject();

subject.DoSomething();

subject.Assert(s => s.DoSomething(), Occurs.Once());
}

[TestMethod]
public void ThisWillPass()
{
var subject = Mock.Create<ISubject>();

subject.DoSomething();

subject.Assert(s => s.DoSomething(), Occurs.Once());
}

public interface ISubject
{
void DoSomething();
}

private static ISubject CreateSubject()
{
return Mock.Create<ISubject>();
}

In this code, the first test will fail but the second test will pass. The only difference is that, in the first test, we're setting up the mock in a helper method.

We have a "Unit Test Library (.NET for Windows Store apps)" referencing the Telerik.JustMock assembly. I have attached a simple project containing this implementation.

It's worth noting that the same code passes in a regular .NET class library; it only fails in a "Unit Test Library (.NET for Windows Store apps)". It's also worth noting that this worked under an older version of the assembly (2014.3.1021.2).

Any help would be appreciated, as we currently have around 3,000 tests and a good proportion of them set up their mocks using a helper method in this way.

Regards
William Cowell
Problem by William Cowell Status: New Comments: 2 Attachments: 1 Last update: 2015-12-01T11:51:09 by Stefan Dragnev
0
Stefan Dragnev

Support interop-related method signatures - pointers, TypedReference and __arglist

Feedback by Stefan Dragnev Status: Unscheduled Comments: 1 Last update: 2015-10-14T08:22:17 by Stefan Dragnev
0
Brian Dunnington

Support Windows 10 UWP/UAP unit test projects

Any plans to support Windows 10 UWP/UAP projects? I tried the existing version but ran into several roadblocks:

Attempt #1 (does not work):
Cannot add JustMockLite to a Windows 10 Unit Test project via NuGet because UAP projects are not supported.

Attempt #2 (does not work)
Add a reference to the pre-compiled binaries. The Win10 project allows the reference, but when the tests run, it results in a bunch of 'Could not find assembly System.Core v3.5.0.0' exceptions. Tried installing .Net 3.5 but didnt help. Tried building from source and retargeting the framework to 4, 4.5, 4.5.2, and 4.6, but that didnt work (see Attempt #3).
Just a note: when Visual Studio 2015 was in RC status, we had this working. We simply added a reference to the pre-compiled Telerik.JustMocks assembly and things worked. Updating to VS RTM though broke things.

Attempt #3 (does not work)
Compile JustMockLite from source. VS complains that the Win10 Unit Test project is of type NetCore and the JustMock assembly targets NetFramework.

Attempt #4 (does not work)
Add reference to Telerik.JustMock.Portable to Windows 10 Unit Test project. This allows the project to compile and run, but any tests using Mock.Create() fail because System.Diagnostics.StackTrace.ctor is not supported.

Feature Request by Brian Dunnington Status: New Comments: 0 Last update: 2015-08-07T19:01:50 by Brian Dunnington
0
Displaying items 1 - 10 of 17