Unplanned
Last Updated: 26 Jun 2025 09:33 by ADMIN
Created by: Davy
Comments: 1
Type: Feature Request
0

Good morning,

Could you please give me a help in order to use JustMock to moch the HttpContext of my API controller?

I have inclosed you my code extracted from my software with the minimal code I could.

In this one, DealControllerReadByIdShouldReturnDtos works fine but unfortunately I tried for hour to make my DealControllerReadAllShouldReturnDtos test works.

Could you please help me?

In advance I thank you

Davy MANGOLD - Humrig

Unplanned
Last Updated: 25 Feb 2025 12:24 by ADMIN
Currently, the JustMock extension does not work on ARM64 machines with Visual Studio 2022 v17.4 and later.
Unplanned
Last Updated: 16 May 2024 09:48 by ADMIN
Created by: Yosi
Comments: 4
Type: Feature Request
1

Hi.

i saw this: https://www.telerik.com/forums/how-can-i-mock-multiple-instances-of-a-struct

but still dont understand why JustMock works that way in the first place. why does it union struct mocks by value?

the above solution is only possible when i mock a struct i can change (and then add the id to it) but what about struct's from the framework that i cannot control? Is there a way to tell JustMock not to union mock structs?

Thanks,

Yosi

Unplanned
Last Updated: 30 Nov 2023 08:54 by Christian
This request is about making feature parity with the existing functionality that currently supports C#.
Unplanned
Last Updated: 10 May 2023 08:22 by ADMIN
ADMIN
Created by: Kamen Ivanov
Comments: 3
Type: Feature Request
5

			
Unplanned
Last Updated: 25 Apr 2023 15:53 by Ivo
Created by: Ivo
Comments: 0
Type: Feature Request
1

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);
}
The test fails with error:

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]'

Unplanned
Last Updated: 03 Jan 2023 16:56 by ADMIN
Created by: Mihail
Comments: 2
Type: Feature Request
1
Consider the scenario where a class has a string field which is his main data. This class has defined an implicit cast operator to string. When that cast operator is executed the resulted string will contain the value from the class field.

Implement support for mocking of an operator such as the one described. 
Unplanned
Last Updated: 10 Nov 2022 09:40 by Ivo
Mocking of these methods could not be made due to compiler (CS8175) or runtime (System.InvalidProgramException: Cannot create boxed ByRef-like values) errors.
Unplanned
Last Updated: 04 Jul 2022 11:41 by Ivo
Created by: Ivo
Comments: 0
Type: Feature Request
1

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.

Unplanned
Last Updated: 01 Dec 2021 14:06 by ADMIN
Created by: Ivo
Comments: 0
Type: Feature Request
1
Coverlet (https://github.com/coverlet-coverage/coverlet) is a cross-platform .NET code coverage tool, so the integration should be considered for all currently (and also potentially) supported platforms by JustMock.
Unplanned
Last Updated: 07 Oct 2021 14:06 by ADMIN
Created by: Alan
Comments: 4
Type: Feature Request
2
I am in the process of building an internal developer platform on kubernetes. Historically, in order to run justmock on build servers we pointed to a special location of the windows registry for accessing the DLL. In kubernetes, the build runners are kubernetes nodes. Is there a preferred way to run these tests in this environment? I can provide more details if it is helpful or valuable. Historically, we used Azure Devops build agents in this new world dotnet test is being run in Linux gitlab agents and not windows. I would have chosen linux in the dropdown but wasn't available.
Unplanned
Last Updated: 19 Aug 2021 07:54 by ADMIN

The new public API should allow the developer to access the invocations for a particular arrangement. Something like the following:

IEnumerable<IInvocaiton> invocations = foo.GetInvocationsFor((x) => x.CalcData(2, 2));

Unplanned
Last Updated: 10 Feb 2021 10:47 by ADMIN
Created by: Toshio
Comments: 1
Type: Feature Request
0
An attempt to use future mocking fails. The attached sample demonstrates the issue.
Unplanned
Last Updated: 18 Sep 2020 08:00 by ADMIN
Created by: Dan Avni
Comments: 1
Type: Feature Request
0
After creating a future mock for some method in an object in which I also specify the mock must be called, there is no way to assert that the mock was actually called. Using Mock.Assert on the test method always passes even when the mocked method was not called.
Unplanned
Last Updated: 25 Jun 2020 14:08 by ADMIN
Currently, the JustMock tests are failing when the Live Unit testing functionality is started. JustMock should provide integration for the Visual Studio Live Unit testing functionality.
Unplanned
Last Updated: 12 Jun 2020 07:22 by ADMIN
Created by: Mihail
Comments: 0
Type: Feature Request
0
Implement support for VS Code.
Unplanned
Last Updated: 22 Apr 2020 15:26 by ADMIN
The Add/Update JustMock reference is shown for .NET Core projects but without implementation it does nothing.
Unplanned
Last Updated: 07 Apr 2020 12:07 by ADMIN
In some cases, the working directory of the test execution needs to be changed to a dedicated path. Currently, it is not possible out of the box, as a workaround can be used start command.
Unplanned
Last Updated: 26 Nov 2019 10:08 by ADMIN
.Net for application developers prefer writing their build script using cake. It is necessary for JustMock to have a cake utility to work with. 
Unplanned
Last Updated: 05 Jun 2019 11:59 by ADMIN

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; }


1 2