Beispiel #1
0
        public void GetGameById_Right_Data()
        {
            // Arrange
            var getGameById = new GetGameByIdQuery { Id = 1 };

            // Act
            var result = _queryHandler.Retrieve(getGameById);

            // Assert
            _gameRepositoryMock.Verify(x => x.Get(It.Is<Int32>(i => i == 1)), Times.Once());
            Assert.AreEqual("Dota 2", result.Name);
        }
Beispiel #2
0
        public void GetGameById_Id_Argument_Lower_Than_Zero()
        {
            // Arrange
            var getGameById = new GetGameByIdQuery { Id = -1 };

            // Act
            var result = ExceptionAssert.Throws<ArgumentOutOfRangeException>(() =>
                _queryHandler.Retrieve(getGameById));

            // Assert
            _gameRepositoryMock.Verify(x => x.Get(It.IsAny<Int32>()), Times.Never);
            Assert.AreEqual("Id", result.ParamName);
        }