Blog.Logic.Core.Tests.ViewCountLogicTest.ShouldThrowExceptionWhenAddViewCountFails C# (CSharp) Méthode

ShouldThrowExceptionWhenAddViewCountFails() private méthode

private ShouldThrowExceptionWhenAddViewCountFails ( ) : void
Résultat 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()));
        }
    }