Allow future mocking of an entire class, including a default of DoNothing() for all methods in the class, rather than requiring each method to be future mocked separately.
Currently, there is no out of the box support for passing "out" and "ref" parameters for nonpublic API.
MbUnitContextResolver gets wrongly initialized because of the weak check based on Gallio.Framework.Assertions.AssertionException type presence in the current app domain. Needs to be improved with some additional type check from mbunit assembly, MbUnit.Framework.TestFixtureAttribute for example.
It would be good if we could use named parameters inside Mock.Arrange method.
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.
Current behavior: Mock.Arrange(xxx).IgnoreInstance(); //mock all future instances of the type on which I set an expectation. Feature Request: Mock.Arrange(xxx).IgnoreInstance().Next(); //mock the next instance of the type on which I set an expectation. ...and even better... Mock.Arrange(xxx).IgnoreInstance().Skip(3).Next(); //mock the 4th instance of a type on which I set an expectation.
Our team is moving to VSTS and not having an official solution to run JustMock tests through their build system is a deal-breaker.
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
I want to check the order of methode calls but InSequence() does not work for it.
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); }
eg // Act testSUT.Execute(1); // Assert myMockThing.Assert(x => x.Foo, Occurs.Once(), "calling Execute() with 1 should execute Foo due to blah");
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.
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.
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 }
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
JustMock should be able to mock in WP8 assemblies.
Remove obfuscation of exceptions thrown by JustMock, because they can cause failing builds on Jenkins