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