Exemplo n.º 1
0
        public void ThrowArgumentNullExcpetion_WhenIsPassed_InvalidArgumentValue()
        {
            // Arrange
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var mockedRepo       = new Mock <IEfRepository <ComicsDataModel> >();

            var comicsService = new ComicsService(mockedUnitOfWork.Object, mockedRepo.Object);

            // Act & Assert
            Assert.That(() => comicsService.GetComic(null),
                        Throws.ArgumentNullException.With.Message.Contain("title"));
        }
Exemplo n.º 2
0
        public void Call_AllProperty_ForTheRepository()
        {
            // Arrange
            var comicsDataModels = new List <ComicsDataModel>();

            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var mockedRepo       = new Mock <IEfRepository <ComicsDataModel> >();

            mockedRepo.Setup(repo => repo.All).Returns(comicsDataModels);

            var comicsService = new ComicsService(mockedUnitOfWork.Object, mockedRepo.Object);

            // Act
            comicsService.GetComic("title");

            // Assert
            mockedRepo.Verify(repo => repo.All, Times.Once);
        }