예제 #1
0
        public void GetNameEventWithIdDoesNotExistThrowsTest()
        {
            _repositoryMock
            .Setup(x => x.GetSingleOrDefault(It.IsAny <int>()))
            .Returns((Event)null);

            var exception = Assert.Throws <BusinessException>(() =>
                                                              _eventAccessor.GetName(1));

            _repositoryMock.Verify(x => x.GetSingleOrDefault(It.Is <int>(y => y == 1)), Times.Once);
            Assert.Equal("Event with id 1 doesn't exist", exception.Message);
        }