public async Task Remover(DroneModel droneModel)
        {
            var drone = _mapper.Map <DroneModel, Drone>(droneModel);

            _unitOfWork.Drones.Remover(drone);
            await _unitOfWork.SaveAsync();
        }
        public async Task AdicionarAsync(DroneModel droneModel)
        {
            var drone = _mapper.Map <DroneModel, Drone>(droneModel);
            await _unitOfWork.Drones.AdicionarAsync(drone);

            await _unitOfWork.SaveAsync();
        }
 public DroneTechInfo(DroneModel model, double batteryCharge, int countOfTasks, float longitude, float latitude)
 {
     Model         = model;
     BatteryCharge = batteryCharge;
     CountOfTasks  = countOfTasks;
     Longitude     = longitude;
     Latitude      = latitude;
 }
Exemple #4
0
        //[Test]
        public void SetDroneStartPositionIncorrectInput_ThrowsException()
        {
            Movement mapZone = new Movement();
            var      drone   = new DroneModel();


            var ex = Assert.Throws <ArgumentException>(() => mapZone.setDroneStartPosition(drone, "1 2 2"));

            Assert.That(ex.Message, Is.EqualTo("Input must be in the correct format. For example '1 2 E'"));
        }
Exemple #5
0
        public void MoveDroneIncorrectInput_ThrowsException()
        {
            Movement mapZone = new Movement();
            var      drone   = new DroneModel();

            //mapZone.moveDrone(drone, "T");

            var ex = Assert.Throws <ArgumentException>(() => mapZone.moveDrone(drone, "T"));

            Assert.That(ex.Message, Is.EqualTo("Input must contain 'L', 'R' or 'M'. User has input: 'T'"));
        }
Exemple #6
0
        public void TurnDroneLeft_FromNorthReturnsWest()
        {
            Movement mapZone    = new Movement();
            var      drone      = new DroneModel();
            var      inputDrone = new DroneModel();

            drone.SetDirection(CardinalDirections.West);
            inputDrone.SetDirection(CardinalDirections.North);
            var expectedDrone = new Likeness <DroneModel, DroneModel>(drone);

            mapZone.turnLeft(inputDrone);

            Assert.AreEqual(inputDrone, expectedDrone);
        }
Exemple #7
0
        public void SetDroneStartPosition_ReturnsCorrectPosition()
        {
            Movement mapZone    = new Movement();
            var      drone      = new DroneModel();
            var      inputDrone = new DroneModel();
            //var expectedDrone = new DroneModel();
            var expectedDrone = new Likeness <DroneModel, DroneModel>(drone);

            drone.xCord = 1;
            drone.yCord = 2;
            drone.SetDirection(CardinalDirections.East);

            mapZone.setDroneStartPosition(inputDrone, "1 2 E");

            Assert.AreEqual(inputDrone, expectedDrone);
        }
Exemple #8
0
        public async Task <IActionResult> Adicionar(DroneModel droneModel)
        {
            await _droneService.AdicionarAsync(droneModel);

            return(Ok());
        }