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.
AxoCover is test runner and a code coverage tool. https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover https://github.com/axodox/AxoCover
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.
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.
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/
There are no ReturnsAsync methods for mocking container async methods.
There should be a set of methods to mock async methods of a container similar to regular object mocking.
As a user I should be able to write code like:
container.Arrange<IContainer>(r => r.SomeAsyncMethod("data")).ReturnsAsync("returnValue");
JustMock interprets anonymous types as tuples. The sample below demonstrates the issue:
public interface IAnsweringService
{
(int code, string desc) GetAnswer(string question);
}
[TestMethod]
public void AnswerToTheUniverseQuestionTest()
{
var apiMock = Mock.Create<IAnsweringService>();
var expectedAnswer = new { code = 42, desc = "Answer to the Ultimate Question of Life" };
Mock.Arrange(() => apiMock.GetAnswer(Arg.AnyString)).Returns(expectedAnswer);
var actualAnswer = apiMock.GetAnswer("What is a universe question answer?");
Assert.AreEqual(expectedAnswer.code, actualAnswer.code);
Assert.AreEqual(expectedAnswer.desc, actualAnswer.desc);
}
Telerik.JustMock.Core.MockException: The chained return value type '<>f__AnonymousType1`2[System.Int32,System.String]' is not compatible with the arranged method's return type 'System.ValueTuple`2[System.Int32,System.String]'
The threading model of UI apps differs from the test host and this might become a source of issues like the following: System.InvalidOperationException: "The calling thread must be STA, because many UI components require this". The request is about extending JustMock with some helpers that can be used to solve this issue easily.
Hi I have encountered what I think is a bug.
I would expected the following unit test to pass. It does not.
The example is distilled from a more complex case.
Is it not supported to have other threads create mocks?
[Fact]
public async Task Fails()
{
var iTask = Task.Run(() => Mock.Create<I>());
var i = await iTask;
EA expectedArgs = new EA();
EA receivedArgs = null;
i.Done += (sender, ea) => receivedArgs = ea;
i.Raise(x => x.Done += null, expectedArgs);
Assert.Equal(expectedArgs, receivedArgs);
}
public class EA : EventArgs
{
}
public interface I
{
event EventHandler<EA> Done;
}