Exemple #1
0
        public void ThrowWhenArgumentCreatureHasNullValue()
        {
            //Arrange
            var      mockedDataProvider = new Mock <IEfAquaWorldDataProvider <Creature> >();
            Creature nullCreature       = null;

            //Act
            var actualCreatureService =
                new AquaWorld.Data.Services.CreatureService(mockedDataProvider.Object);

            //Assert
            Assert.That(
                () => actualCreatureService.Create(nullCreature),
                Throws.InstanceOf <ArgumentNullException>());
        }
Exemple #2
0
        public void CallCreatureDataProviderSaveChangesMethod()
        {
            //Arrange
            var mockedDataProvider = new Mock <IEfAquaWorldDataProvider <Creature> >();
            var mockedCreature     = new Mock <Creature>();

            //Act
            var actualCreatureService =
                new AquaWorld.Data.Services.CreatureService(mockedDataProvider.Object);

            actualCreatureService.Create(mockedCreature.Object);

            //Assert
            mockedDataProvider.Verify(
                service => service.SaveChanges(),
                Times.Once);
        }
Exemple #3
0
        public void CallCreatureDataProviderAddMethodWithSameRecievedCreature()
        {
            //Arrange
            var mockedDataProvider = new Mock <IEfAquaWorldDataProvider <Creature> >();
            var mockedCreature     = new Mock <Creature>();

            //Act
            var actualCreatureService =
                new AquaWorld.Data.Services.CreatureService(mockedDataProvider.Object);

            actualCreatureService.Create(mockedCreature.Object);

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