Blog.Logic.Core.Tests.ViewCountLogicTest.ShouldThrowExceptionWhenAddViewCountFails C# (CSharp) Method

ShouldThrowExceptionWhenAddViewCountFails() private method

private ShouldThrowExceptionWhenAddViewCountFails ( ) : void
return void
        public void ShouldThrowExceptionWhenAddViewCountFails()
        {
            _viewCountRepository = new Mock<IViewCountRepository>();
            _viewCountRepository.Setup(a => a.Add(It.IsAny<ViewCount>())).Throws(new Exception());

            _viewCountLogic = new ViewCountLogic(_viewCountRepository.Object);

            Assert.Throws<BlogException>(() => _viewCountLogic.Add(new Common.Contracts.ViewCount()));
        }
    }