Exemplo n.º 1
0
        public void Setup()
        {
            _dto = new ZooAnimalTypeDto()
            {
                DyingTimeInSeconds          = 10,
                MinHealthRequiredForLife    = 30,
                MinHealthRequiredForWalking = 40,
                Name = "Giraffe"
            };

            _zooAnimalType    = new ZooAnimalType(_dto);
            _generalZooAnimal = new ZooAnimal(_zooAnimalType, Mock.Of <IZoo>());
        }
Exemplo n.º 2
0
        private ZooAnimal GetDeadAnimal()
        {
            var now            = DateTime.UtcNow;
            var nowPlusOneHour = now.AddHours(1);

            var mockZoo = new Mock <IZoo>();

            mockZoo.SetupSequence(x => x.TimeOfDay)
            .Returns(now)
            .Returns(now)
            .Returns(nowPlusOneHour);

            mockZoo.Setup(x => x.TimeIncrements).Returns(360);
            var zooAnimal = new ZooAnimal(_zooAnimalType, mockZoo.Object);

            //kill the animal
            zooAnimal.DecreaseHealth(71);
            mockZoo.Raise(x => x.StatusChanged += null, this, new EventArgs());
            return(zooAnimal);
        }