Monday, November 4, 2019

Make the same method conditionally return different stuff with MOQ.

playerRepository.Setup(p => p.FindPlayer(It.IsAny<long>())).Returns((long id) => id==1
      ? new Player() { PlayerId = 1, PlayerIp = "127.0.0.1" }
      : new Player() { PlayerId = 2, PlayerIp = "128.0.0.1" }
   );

No comments:

Post a Comment