Click here to Skip to main content
14,327,370 members
Rate this:
Please Sign up or sign in to vote.
See more:
In moq setup I am trying to assign the value of one of the argument to a string variable. Although I used callback but still the variable seems to have null value.

What I have tried:

I tried this

Mock<ILunaService> partialMockLunaService = new Mock<ILunaService>(MockBehavior.Strict);
            partialMockLunaService.Setup(x => x.TranslateText(It.IsAny<MachineTranslationProviderEnum>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<MachineTranslationOptionsDto>()))
                .Callback<MachineTranslationProviderEnum, int, int, string, MachineTranslationOptionsDto>((a, b, c, d, e) => actualTextForTranslation = d);  
Updated 28-May-19 6:14am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100