public void GetById() { // Arrange var searchSetId = 2; _mock.Setup(s => s.Get(It.IsAny <int>())).Returns <int>(searchId => { return(_sets.Where(tr => tr.Id == searchId).FirstOrDefault()); }); // Act var result = _setService.Get(searchSetId); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SetDTO)); Assert.IsTrue(result.Id > 0); }