Human Amdjadi-Bigwand

I want to check the order of methode calls but InSequence() does not work

I want to check the order of methode calls but InSequence() does not work for it.

Feedback by Human Amdjadi-Bigwand Status: Rejected Comments: 3 Last update: 2016-08-17T08:54:25 by Vladimir Dragoev
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
Anand Rau

Mock.SetupStatic not working with RoleEnvironment

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);
}
Problem by Anand Rau Status: Completed Comments: 1 Last update: 2015-11-24T08:37:22 by Simo Hauml
0
Nathan Johnstone

assert to include a "because" reason like fluentassertions as this makes it clearer what was expected when an assert fails

eg

// Act
testSUT.Execute(1);

// Assert
myMockThing.Assert(x => x.Foo, Occurs.Once(), "calling Execute() with 1 should execute Foo due to blah");
Feature Request by Nathan Johnstone Status: Completed Comments: 1 Last update: 2015-10-14T08:48:24 by Stefan Dragnev
0
Калоян Которов

A way to reset occurrences of a certain method

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.
Feedback by Калоян Которов Status: Rejected Comments: 1 Last update: 2015-10-14T08:26:39 by Stefan Dragnev
0
Jonathan Lavering

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 envi

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.
Feature Request by Jonathan Lavering Status: Completed Comments: 3 Last update: 2015-10-14T08:25:24 by Stefan Dragnev
0
Калоян Которов

A Mock.Create behavior, that will arrange all functions to OccursNever automatically instead of throwing exceptions

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
}
Feature Request by Калоян Которов Status: Completed Comments: 1 Last update: 2015-10-14T08:23:56 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
Displaying items 1 - 10 of 46