JustMock should work in multi-threaded scenarios.
JustMock should be able to mock in WP8 assemblies.
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.
I use NCrunch, a popular test runner. But it cannot seem to activate the JustMock profiler properly. So tests that require use of the JustMock profiler do not work properly.
JustMock should be able to mock private methods in Silverlight.
Currently, when the JustMock profiler is enabled it provides a performance hit on the test execution. This effect is expected because a profiler is involved.
What we can do is find a more optimized way of instrumenting the methods.
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 }
I want to be able to arrange the return value of `new` expressions, like Mock.Arrange(() => new FileInfo()).Returns(mockFileInfo). Then, I expect that `new FileInfo()` will always return my mock instance.
It would be good if we could use named parameters inside Mock.Arrange method.
We're developing .net 5/core services, using Rider IDE and MacOS.
Please:
1. Add support to run JustMock under MacOS (profiler need to be supported, enabled issue, etc.), or if already supported, please provide instructions of how to activate it per test, for example using NUnit.
2. Add integration with Rider so all the process will be much easier.
C# 8 introduces default interface method implementations. Attempt to mock such methods with JustMock in elevated mode fails. The following example illustrates the issue:
public interface IMyInterface
{
int IntProperty { get => 0; }
}
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var mock = Mock.Create<IMyInterface>();
Mock.Arrange(() => mock.IntProperty).Returns(1);
Assert.AreEqual(1, mock.IntProperty);
}
}
I'd like to be able to make recursive arrangements like Mock.Arrange(() => a.B.C.D).Returns(5) and to simultaneously specify that this arrangement should work on any instance, not just 'a'. If I simply use IgnoreInstance() in this case it will make an arrangement for the instance on which 'D' is called and not 'B' - so it doesn't work as I want it to. What I'd like to do is simply state Mock.Arrange(() => Arg.IsAny<IFoo>().B.C.D).Returns(5) - in other words "Arrange for any object of type IFoo, when ".B.C.D" is called on it, that the value of D is 5.
eg // Act testSUT.Execute(1); // Assert myMockThing.Assert(x => x.Foo, Occurs.Once(), "calling Execute() with 1 should execute Foo due to blah");
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.
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