Answer the question
In order to leave comments, you need to log in
Why is the value null?
Hello everyone, the question is the following, there is the following unit test fragment
// Arrange
var mock1 = new Mock<IRtbService>();
mock1
.Setup(a => a.GetAuctionResult(rtb_partners, auctionModel))
.ReturnsAsync("VAST");
Answer the question
In order to leave comments, you need to log in
Most likely because rtb_partners and auctionModel do not match what is passed to it.
As I understand it, the comparison is by reference and the mock returns null.
If you don’t really care what comes there, then you can unconditionally configure:
var mock1 = new Mock<IRtbService>();
mock1
.Setup(a => a.GetAuctionResult(It.IsAny<IEnumerable>(), It.IsAny<AuctionModel>()))
.ReturnsAsync("VAST");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question