Ejemplo n.º 1
0
        public void ThrowWhenArgumentComicHasNullValue()
        {
            //Arrange
            var   mockedDataProvider = new Mock <IEfComicShopDataProvider <Comic> >();
            Comic nullComic          = null;

            //Act
            var actualComicService =
                new ComicShop.Data.Services.ComicService(mockedDataProvider.Object);

            //Assert
            Assert.That(
                () => actualComicService.Create(nullComic),
                Throws.InstanceOf <ArgumentNullException>());
        }
Ejemplo n.º 2
0
        public void CallComicDataProviderSaveChangesMethod()
        {
            //Arrange
            var mockedDataProvider = new Mock <IEfComicShopDataProvider <Comic> >();
            var mockedComic        = new Mock <Comic>();

            //Act
            var actualComicService =
                new ComicShop.Data.Services.ComicService(mockedDataProvider.Object);

            actualComicService.Create(mockedComic.Object);

            //Assert
            mockedDataProvider.Verify(
                service => service.SaveChanges(),
                Times.Once);
        }
Ejemplo n.º 3
0
        public void CallCreatureDataProviderAddMethodWithSameRecievedComic()
        {
            //Arrange
            var mockedDataProvider = new Mock <IEfComicShopDataProvider <Comic> >();
            var mockedComic        = new Mock <Comic>();

            //Act
            var actualComicService =
                new ComicShop.Data.Services.ComicService(mockedDataProvider.Object);

            actualComicService.Create(mockedComic.Object);

            //Assert
            mockedDataProvider.Verify(
                service => service.Add(mockedComic.Object),
                Times.Once);
        }