Exemplo n.º 1
0
        public void Setup()
        {
            _field           = new Mock <IField>();
            _distanceHandler = new Mock <IDistanceHandler>();
            _positionChecker = new Mock <IPositionChecker>();

            _position = new Point(0, 0);

            IAnimal[,] defaultAnimals = new IAnimal[2, 3];

            defaultAnimals[0, 0] = new Antilope();
            defaultAnimals[0, 1] = new Antilope();
            defaultAnimals[0, 2] = new Lion();
            defaultAnimals[1, 0] = null;
            defaultAnimals[1, 1] = null;
            defaultAnimals[1, 2] = new Lion();

            _field.Setup(f => f.Width).Returns(3);
            _field.Setup(f => f.Heigth).Returns(2);
            _field.Setup(f => f.Animals).Returns(defaultAnimals);

            List <Point> ExistingAnimals = new List <Point>();

            ExistingAnimals.Add(new Point(0, 0));
            ExistingAnimals.Add(new Point(1, 0));
            ExistingAnimals.Add(new Point(2, 1));
            ExistingAnimals.Add(new Point(2, 0));

            _positionChecker.Setup(f => f.CheckEmpty(It.IsIn <Point>(ExistingAnimals))).Returns(false);
            _positionChecker.Setup(f => f.CheckEmpty(It.IsNotIn <Point>(ExistingAnimals))).Returns(true);

            _systemUnderTest = new AnimalFinder(_field.Object, _positionChecker.Object, _distanceHandler.Object);
        }
Exemplo n.º 2
0
        public void Cleanup()
        {
            _positionChecker = null;
            _distanceHandler = null;
            _field           = null;
            _systemUnderTest = null;

            _position   = Point.Empty;
            _resultList = null;
        }
Exemplo n.º 3
0
 public MovementHandler
 (
     IPositionHandler positionHandler,
     IPointReplacer pointReplacer,
     IAnimalFinder animalFinder,
     IHealthHandler healthHandler,
     IField field
 )
 {
     _field           = field;
     _positionHandler = positionHandler;
     _pointReplacer   = pointReplacer;
     _animalFinder    = animalFinder;
     _healthHandler   = healthHandler;
 }