public void RetornarStatusDrone()
        {
            var sddUm = new StatusDroneDto {
                ClienteId = 1, PedidoId = 1
            };
            var sddDois = new StatusDroneDto {
                ClienteId = 2, PedidoId = 2
            };

            var listSdd = new List <StatusDroneDto> {
                sddUm, sddDois
            };

            var _droneRepository = new Mock <IDroneRepository>();

            _droneRepository.Setup(_ => _.GetDroneStatus()).Returns(listSdd);

            ICoordinateService     _coordinateService     = null;
            IPedidoDroneRepository _pedidoDroneRepository = null;
            IPedidoRepository      _pedidoRepository      = null;

            var droneService = new DroneService(_coordinateService, _pedidoDroneRepository, _droneRepository.Object, _pedidoRepository);

            var result = droneService.GetDroneStatus();

            Assert.True(result.Count() == 2, "A quantidade de registros retornados não esperada");
        }
        public void finalizaPedido()
        {
            PedidoDrone pedidoUm = new PedidoDrone()
            {
                Id = 1, StatusEnvio = (int)StatusEnvio.EM_TRANSITO
            };
            PedidoDrone pedidoDois = new PedidoDrone()
            {
                Id = 2, StatusEnvio = (int)StatusEnvio.EM_TRANSITO
            };

            List <PedidoDrone> listPedidoDrones = new List <PedidoDrone> {
                pedidoUm, pedidoDois
            };

            var _pedidoDroneRepository = Substitute.For <IPedidoDroneRepository>();

            _pedidoDroneRepository.RetornaPedidosParaFecharAsync().Returns(listPedidoDrones);

            ICoordinateService _coordinateService = null;
            IDroneRepository   _droneRepository   = null;
            IPedidoRepository  _pedidoRepository  = null;

            var droneService = new DroneService(_coordinateService, _pedidoDroneRepository, _droneRepository, _pedidoRepository);

            droneService.FinalizaPedidosAsync().Wait();

            var existepedidoComStatusDiferenteDeFinalizado = listPedidoDrones.Any(_ => _.StatusEnvio != (int)StatusEnvio.FINALIZADO);

            Assert.True(!existepedidoComStatusDiferenteDeFinalizado);
        }
예제 #3
0
 public CoordinatesController(ICoordinateService coordinateService, IMapper mapper, ICoordinateSender coordinateSender, IFileService fileService)
 {
     this.coordinateService = coordinateService;
     this.mapper            = mapper;
     this.coordinateSender  = coordinateSender;
     this.fileService       = fileService;
 }
예제 #4
0
        public static void SetDrag(Map map, Point point, Point origin, Location mouseCenter)
        {
            MouseDragBehavior behavior = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift ?
                                         map.MouseShiftDragMode : map.MouseDragMode;

            switch (behavior)
            {
            case MouseDragBehavior.Drag:
            {
                ICoordinateService coordinateService = CoordinateServiceProvider.GetService(map);
                Point pixelCenter = coordinateService.LogicalToPixel(map.SpatialReference.GeographicToLogical(mouseCenter));
                pixelCenter.X += origin.X - point.X;
                pixelCenter.Y += origin.Y - point.Y;

                Point offset          = map.MultiScaleImage.ViewportOrigin;
                Size  viewLogicalSize = new Size(map.MultiScaleImage.ViewportWidth,
                                                 map.MultiScaleImage.ViewportWidth * map.MultiScaleImage.ActualHeight / map.MultiScaleImage.ActualWidth);

                double pixelFactorX = viewLogicalSize.Width / map.MultiScaleImage.ActualWidth;
                double pixelFactorY = viewLogicalSize.Height / map.MultiScaleImage.ActualHeight;
                Point  logical      = new Point((pixelCenter.X * pixelFactorX) + offset.X, (pixelCenter.Y * pixelFactorY) + offset.Y);
                map.Center = coordinateService.LogicalToGeographic(logical);
            }
            break;

            case MouseDragBehavior.Select:
            {
                map.MouseControl.SelectBoxLocation = new Point(Math.Min(origin.X, point.X), Math.Min(origin.Y, point.Y));
                var newSize = new Size(Math.Abs(origin.X - point.X), Math.Abs(origin.Y - point.Y));
                map.MouseControl.SelectBoxSize = newSize;
            }
            break;
            }
        }
예제 #5
0
 public static void Execute(Robot robot, ICoordinateService coordinateService)
 {
     foreach (var command in robot.Commands)
     {
         coordinateService.ExecuteSteps(robot, command);
     }
 }
예제 #6
0
        public GridOverlayViewModel(ICoordinateService coordinateService,
                                    IWorldConfigRepository loadedWorldConfigRepository,
                                    IMapConfigRepository mapConfigRepository,
                                    ITilesPositionService tilesPositionService,
                                    Transform centerTransform)
        {
            CoordinateVisibilityLiveData = new LiveData <bool>(true);
            GridVisibilityLiveData       = new LiveData <bool>(true);
            CellsCountLiveData           = new LiveData <int>();
            CellsPositionLiveData        = new LiveData <IReadOnlyList <Vector3> >();
            WorldConfigLiveData          = new LiveData <WorldConfig>();
            CoordinatesLiveData          = new LiveData <IReadOnlyList <Coordinate> >();

            _compositeDisposable = new CompositeDisposable
            {
                mapConfigRepository.GetObservableStream()
                .CombineLatest(
                    loadedWorldConfigRepository.GetObservableStream(),
                    tilesPositionService.GetObservableStream(centerTransform.position.y),
                    (mapConfig, worldConfig, positions) => (mapConfig, worldConfig, positions)
                    )
                .Subscribe(
                    tuple =>
                {
                    var(mapConfig, worldConfig, positions) = tuple;
                    var coordinates = coordinateService.GetFlattenCoordinates(mapConfig);

                    UpdateCellsCountsWhenNeeded(coordinates.Count);
                    UpdateCellsPositionWhenNeeded(positions);
                    UpdateWorldConfigWhenNeeded(worldConfig);
                    UpdateCoordinatesWhenNeeded(coordinates);
                }
                    )
            };
        }
 public DroneService(ICoordinateService coordinateService,
                     IPedidoDroneRepository pedidoDroneRepository,
                     IDroneRepository droneRepository)
 {
     _coordinateService     = coordinateService;
     _pedidoDroneRepository = pedidoDroneRepository;
     _droneRepository       = droneRepository;
 }
예제 #8
0
 public LoadBoardItemsService(ICoordinateService coordinateService,
                              IFactory <TBoardItemData, Coordinate, TBoardItem> factory,
                              IBoardItemsSetRepository <TBoardItem> boardItemsSetRepository)
 {
     _coordinateService       = coordinateService;
     _factory                 = factory;
     _boardItemsSetRepository = boardItemsSetRepository;
 }
 public CoordinateReceiver(ICoordinateService coordinateService, IOptions <RabbitMqConfiguration> rabbitMqOptions)
 {
     _hostname          = rabbitMqOptions.Value.Hostname;
     _queueName         = rabbitMqOptions.Value.QueueName;
     _username          = rabbitMqOptions.Value.UserName;
     _password          = rabbitMqOptions.Value.Password;
     _coordinateService = coordinateService;
     InitializeRabbitMqListener();
 }
예제 #10
0
        public RoverService(IPlateauService plateauService, ICoordinateService coordinateService)
        {
            _plateauService    = plateauService;
            _coordinateService = coordinateService;

            CurrentRover = new Rover(
                coordinate: _coordinateService.Coordinate,
                direction: _coordinateService.Direction,
                plateau: _plateauService.Plateau);
        }
 public AssignDroneTests()
 {
     _clienteRepository       = Substitute.For <IClienteRepository>();
     _pedidoService           = Substitute.For <IPedidoService>();
     _droneRepository         = Substitute.For <IDroneRepository>();
     _droneService            = Substitute.For <IDroneService>();
     _pedidoRepository        = Substitute.For <PedidoRepository>();
     _coordinateService       = Substitute.For <ICoordinateService>();
     _pedidoDroneRepository   = Substitute.For <IPedidoDroneRepository>();
     _pagamentoServiceFactory = Substitute.For <IPagamentoServiceFactory>();
 }
예제 #12
0
 public LoadBoardItemsHolderService(ITilesPositionService tilesPositionService,
                                    IBoardItemsGetRepository <TBoardItem> boardItemsRepository,
                                    IGameObjectAndComponentFactory <THolder> holderFactory,
                                    ICoordinateService coordinateService)
 {
     _tilesPositionService       = tilesPositionService;
     _boardItemsRepository       = boardItemsRepository;
     _holderFactory              = holderFactory;
     _coordinateService          = coordinateService;
     _finishedLoadingEventStream = new ReplaySubject <Unit>(1);
 }
예제 #13
0
 public AssignDroneTests()
 {
     _dataContext              = Substitute.For <DataContext>();
     _dataContext.Pedido       = Substitute.For <DbSet <felipe.DTO.Models.Pedido> >();
     _dataContext.PedidoDrones = Substitute.For <DbSet <PedidoDrone> >();
     _clienteRepository        = Substitute.For <IClienteRepository>();
     _pedidoService            = Substitute.For <IPedidoService>();
     _droneRepository          = Substitute.For <IDroneRepository>();
     _droneService             = Substitute.For <IDroneService>();
     _pedidoRepository         = Substitute.For <IPedidoRepository>();
     _coordinateService        = Substitute.For <ICoordinateService>();
     _pedidoDroneRepository    = Substitute.For <IPedidoDroneRepository>();
 }
 public FavoriteController(
     IFavoriteService favService,
     IMapper mapper,
     IOptions <AppSettings> appSettings,
     ICoordinateService coordService,
     ICategoryServices categoryService
     )
 {
     _favService      = favService;
     _mapper          = mapper;
     _appSettings     = appSettings.Value;
     _coordService    = coordService;
     _categoryService = categoryService;
 }
        public static ICoordinateService GetService(Map map)
        {
            ICoordinateService coordinateService = null;

            if (coordinateServices.TryGetValue(map, out coordinateService))
            {
                return(coordinateService);
            }
            else
            {
                coordinateService = new CoordinateService(map);
                coordinateServices.Add(map, coordinateService);
                return(coordinateService);
            }
        }
예제 #16
0
        public static void SetZoomToPoint(Map map, Point point, int zoomAdjustment)
        {
            ICoordinateService coordinateService = CoordinateServiceProvider.GetService(map);
            Point      center        = map.SpatialReference.GeographicToLogical(map.Center);
            Location   newCenter     = map.Center;
            IMapSource mode          = map.Provider.CurrentSource;
            Point      sourceLogical = coordinateService.PixelToLogical(point);
            Location   sourcePoint   = coordinateService.PixelToGeographic(point);

            map.ZoomLevel += zoomAdjustment;
            Point    currentLogical = coordinateService.PixelToLogical(point);
            Location currentPoint   = coordinateService.PixelToGeographic(point);

            if (mode == map.Provider.CurrentSource)
            {
                Point shift = new Point(sourceLogical.X - currentLogical.X, sourceLogical.Y - currentLogical.Y);
                center.X += shift.X;
                center.Y += shift.Y;

                newCenter = map.SpatialReference.LogicalToGeographic(center);
            }
            else
            {
                if (map.Center.Longitude < sourcePoint.Longitude)
                {
                    newCenter.Longitude = map.Center.Longitude + sourcePoint.Longitude - currentPoint.Longitude;
                }
                else
                {
                    newCenter.Longitude = map.Center.Longitude - currentPoint.Longitude + sourcePoint.Longitude;
                }

                if (map.Center.Latitude < sourcePoint.Latitude)
                {
                    newCenter.Latitude = map.Center.Latitude + sourcePoint.Latitude - currentPoint.Latitude;
                }
                else
                {
                    newCenter.Latitude = map.Center.Latitude - currentPoint.Latitude + sourcePoint.Latitude;
                }
            }

            map.Center = newCenter;
        }
예제 #17
0
        /// <summary>
        /// Arrange item in canvas.
        /// </summary>
        /// <param name="item">Item to arrange.</param>
        internal void ArrangeItem(UIElement element)
        {
            MapCanvasItem item = null;

            this.internalItems.TryGetValue(element.GetHashCode(), out item);

            if (item != null)
            {
                Location location = MapLayer.GetLocation(element);
                if (location.IsEmpty)
                {
                    return;
                }

                ICoordinateService coordinateService = CoordinateServiceProvider.GetService(this.Map);
                Point pixel = coordinateService.GeographicToPixel(location);
                this.SetItemPosition(item, pixel);
            }
        }
예제 #18
0
 public TurtleService(IBoardService boardService, ICoordinateService coordinateService)
 {
     _boardService      = boardService;
     _coordinateService = coordinateService;
 }
 public CoordinateListsController(ICoordinateService coordinateService, ISquareService squareService)
 {
     _coordinateService = coordinateService;
     _squareService     = squareService;
 }
예제 #20
0
 public BoardService(IMineService mineService, ICoordinateService coordinateService)
 {
     _mineService       = mineService;
     _coordinateService = coordinateService;
 }
예제 #21
0
 public CoordinateListController(ICoordinateService coordinateListService)
 {
     _service = coordinateListService;
 }
예제 #22
0
 public MineService(ICoordinateService coordinateService)
 {
     _coordinateService = coordinateService;
 }
예제 #23
0
 public LevelDataEditingService(ICoordinateService coordinateService)
 {
     _coordinateService = coordinateService;
 }
 public CoordinateController(ICoordinateService coordinateService)
 {
     _coordinateService = coordinateService;
 }
예제 #25
0
 public GameObjectLoadService(ICoordinateService coordinateService)
 {
     _coordinateService = coordinateService;
 }
예제 #26
0
 public PedidoService(IDroneService droneService, ICoordinateService coordinateService)
 {
     _droneService      = droneService;
     _coordinateService = coordinateService;
 }
 public FavoriteService(IFavoritesRepository favRepo, ICategoryServices categoryService, ICoordinateService coordinateService)
 {
     _favRepo           = favRepo;
     _categoryService   = categoryService;
     _coordinateService = coordinateService;
 }