public void GetCommentsByGameKey_Key_Argument_Is_Null() { // Arrange var getCommentsByGameKey = new GetCommentsByGameKeyQuery { Key = null }; // Act var result = ExceptionAssert.Throws<ArgumentNullException>(() => _queryHandler.Retrieve(getCommentsByGameKey)); // Assert _unitOfWorkMock.Verify(x => x.Comments, Times.Never); _unitOfWorkMock.Verify(x => x.Games, Times.Never); Assert.AreEqual("Key", result.ParamName); }
public void GetCommentsByGameKey_Right_Data() { // Arrange var getCommentsByGameKey = new GetCommentsByGameKeyQuery { Key = "dota-2" }; // Act var result = _queryHandler.Retrieve(getCommentsByGameKey); // Assert Assert.AreEqual(1, result.Count()); }
public void GetCommentsByGameKey_Key_Argument_Doesnt_Match_Existing_Game() { // Arrange var getCommentsByGameKey = new GetCommentsByGameKeyQuery { Key = "notExisingGame" }; // Act var result = ExceptionAssert.Throws<ArgumentException>(() => _queryHandler.Retrieve(getCommentsByGameKey)); // Assert _gameRepositoryMock.Verify(x => x.GetSingle(It.IsAny<Expression<Func<Game, bool>>>()), Times.Once); Assert.AreEqual("Key", result.ParamName); }