Approved
Last Updated: 23 Jul 2018 13:16 by Stefan
I'm a user that is refactoring a legacy system which has a certain component to which I do not have the source. It uses COM interop heavily. I would like to be able to future-mock instances of RCW's so that I can write tests for that component.
Approved
Last Updated: 23 Jul 2018 13:10 by Stefan
Created by: Stefan
Comments: 0
Type: Feature Request
0
I'd like to be able to intercept and arrange access to fields on any class.

public class Dependency
{
  public int A;
}
..
var dep = new Dependency();
Mock.Arrange(() => dep.A).Returns(5);
Mock.ArrangeSet(() => dep.A = Arg.AnyInt).DoInstead(...);
Approved
Last Updated: 23 Jul 2018 13:04 by ADMIN
ADMIN
Created by: Vladi
Comments: 0
Type: Feature Request
2
Integrate with Simple Injector: https://simpleinjector.org/index.html similar to https://www.nuget.org/packages/JustMock.Unity and https://www.nuget.org/packages/JustMock.Mef/
Approved
Last Updated: 23 Jul 2018 12:55 by Brian
Created by: Brian
Comments: 0
Type: Feature Request
18
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.

Approved
Last Updated: 23 Jul 2018 12:48 by Stefan
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
Completed
Last Updated: 22 Jun 2018 07:48 by Jeremy
Created by: Michele
Comments: 3
Type: Bug Report
0
In Visual Studio 2015 Pro justmock generates this error error MSB6006: "vbc.exe" To function properly you need to uninstall VS2015 justmock.

Bye
Completed
Last Updated: 01 Mar 2018 15:48 by ADMIN
Created by: G
Comments: 1
Type: Feature Request
1
Our team is moving to VSTS and not having an official solution to run JustMock tests through their build system is a deal-breaker.
Approved
Last Updated: 04 Jan 2018 09:36 by Josh
ADMIN
Created by: Kamen Ivanov
Comments: 1
Type: Feature Request
4

			
Approved
Last Updated: 29 Nov 2017 14:20 by ADMIN
ADMIN
Created by: Mihail
Comments: 0
Type: Feature Request
5
AxoCover is test runner and a code coverage tool.

https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover

https://github.com/axodox/AxoCover
Declined
Last Updated: 29 Nov 2017 12:53 by ADMIN
Tests fail when run with vstest.console.exe but pass when run from VS2015.

Findings: The problematic scenario includes reference to Microsoft.WindowsAzure.ServiceRuntime.dll and usage of the RoleEnvironment class. When the RoleEnvironment class is used in a test project without JustMock and runned from vstest.console the exception will be thrown as well. Here is the exact exception: 
System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception. ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
 ---> System.Runtime.InteropServices.COMException: Invalid operation. (Exception from HRESULT: 0x80131022)
Stack Trace:
    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at <CrtImplementationDetails>.GetDefaultDomain()
   at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)
   at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
   at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
   at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
--- End of inner exception stack trace ---
    at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
   at .cctor()
--- End of inner exception stack trace ---
    at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
--- End of inner exception stack trace ---
    at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable()

Workaround: the vstest.console.exe could be started with parameter /InIsolation, which runs the tests in an isolated process. Here is the link to the command line options: https://msdn.microsoft.com/en-us/library/jj155796.aspx
Pending Review
Last Updated: 18 Oct 2017 14:56 by Stacey
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.
Pending Review
Last Updated: 19 Apr 2017 08:19 by Maxim
Created by: Maxim
Comments: 0
Type: Bug Report
0
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.
Declined
Last Updated: 17 Aug 2016 08:54 by ADMIN
I want to check the order of methode calls but InSequence() does not work for it.

Completed
Last Updated: 24 Nov 2015 08:37 by Simo
I have installed the trial version of JustMock to evaluate it. I have been trying to mock the static calls of Azure RoleEnvironment class, but the SetupStatic does not work. It seems to be calling the original method. Please see my simple test below:

[Test]
public void VerifyRoleEnvironment()
{
       bool expected = true;
       Mock.SetupStatic(typeof(RoleEnvironment), StaticConstructor.Mocked);
       Mock.Arrange(() => RoleEnvironment.IsAvailable).Returns(true);
       Assert.AreEqual(expected, RoleEnvironment.IsAvailable);
}
Completed
Last Updated: 14 Oct 2015 08:48 by Stefan
eg

// Act
testSUT.Execute(1);

// Assert
myMockThing.Assert(x => x.Foo, Occurs.Once(), "calling Execute() with 1 should execute Foo due to blah");
Declined
Last Updated: 14 Oct 2015 08:26 by Stefan
Created by: Kaloyan
Comments: 1
Type: Feature Request
1
I have a unit test where I assert that a certain action will call a method on a mock dependency object by using Mock.Assert().  I want to ensure that the action I take calls the method on the mock object exactly once.  The problem is that the setup of the unit test creates a scenario where the method of the mock object will also be called, so when I assert that the call to the mock object happened just once it fails because it has actually been called more than once.

Is there a way to "reset" the call tracking of methods on mock objects?  I basically want to tell JustMock that at a certain point, whatever calls have happened to my mock objects should be discarded and the call counter should basically start at 0 again.
Completed
Last Updated: 14 Oct 2015 08:25 by Stefan
Make Justmock full edition as easy to use as the lite edition. For my team to use Justmock in Visual Studio and have unit tests run in the build system outside of VS, it is not practical to have justmock "installed" on everyone's machine. the process environment variables that need to be set is also not practically due to our custom build system; the process to start VS on our dev's enlistments is complicated and tightly controlled. Also, the profiler interferes with VS Code Coverage and we shouldn't have to use another UI to add the profiler, as that has to be done on every machine. We have to resort to just using JustMock Lite.
Completed
Last Updated: 14 Oct 2015 08:23 by Stefan
We have some mission critical code that catches all exceptions and recovers from them in various ways.  I would like to be able to use Mock.Create<MyClass>(Behavior.Strict) so that I can know that none of the methods on MyClass are being called besides the ones I explicitly Mock.Arrange.  However, this results in the methods throwing exceptions which are then caught by my application and recovered from so I never see them.

I would like something like this, but where I didn't have to manually arrange every method on the class and instead have some Behavior that I could give to Mock.Create that would result in all of the arranges being auto-generated.  I could then manually arrange anything I didn't want to have OccursNever on, just like you can override the exceptions thrown by Behavior.Strict.


class MyClass
{
    public void Method1() { }
    public void Method2() { }
    public void Method3() { }
}
 
class ClassUnderTest
{
    public void DoSomething(MyClass myClass)
    {
        myClass.Method3();
    }
}
 
[Test]
void MyClass_methods_are_never_called()
{
    // ARRANGE
    var myClass = Mock.Create<MyClass>();
    Mock.Arrange(() => myClass.Method1()).OccursNever();
    Mock.Arrange(() => myClass.Method2()).OccursNever();
    Mock.Arrange(() => myClass.Method3()).OccursNever();
 
    // ACT
    var classUnderTest = new ClassUnderTest();
    classUnderTest.DoSomething(myClass);
 
    // ASSERT
    Mock.Assert(myClass); // this will fail
}
Declined
Last Updated: 14 Oct 2015 08:18 by Stefan
Created by: Sebastian
Comments: 1
Type: Feature Request
0
Does Telerik JustMock work for Windows 8.1 environment?
We have a solution targeting Windows 8.1. 
I haven't been able to use Telerik JustMock.
Is there any workaround to make it work or some planned release for this  framework.
Best regards,
Sebas
Completed
Last Updated: 30 Jun 2015 11:38 by Joe
Created by: Kaloyan
Comments: 1
Type: Feature Request
8
JustMock should be able to mock in WP8 assemblies.