Last active
June 6, 2017 11:57
-
-
Save marzoukali/4c16b301cffa4ed499fcc1d10f1a895c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class GameServiceTests | |
{ | |
[Test] | |
public void GetGameById_WithValidId_ReturnsGame() | |
{ | |
// Arrange and Act | |
var mockUnitOfWork = new Mock<IUnitOfWork>(); | |
var mockQueries = new Mock<IQueries<Game>>(); | |
var mockQueryable = new Mock<IQueryable<Game>>(); | |
var query = new List<Expression<Func<Game, bool>>> { c => c.Id == 1 }; | |
var quarable = new List<Game> { new Game { Id = 1 } }; | |
//quarable = ; | |
// var gameQuery = mockQueries.Setup(q => q.Query(query,null,null)).Returns(mockQueryable.Object); | |
// mockUnitOfWork.Setup(x => x.GameQueries).Returns(mockQueries.Object); | |
mockUnitOfWork.Setup(x => x.GameQueries.Query(query, null, null)).Returns(quarable.AsQueryable()); | |
// Assert | |
Assert.AreEqual(mockUnitOfWork.Object.GameQueries.Query(query), new Game { Id = 1 }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment