public async Task When_Remove_Products_Of_Warehouse_Is_Correct_Remove_Product_Warehouse() { //Arrange var loggerMock = new Mock <ILogger <MovementService> >(); Mock <IGenericRepository <Movement> > repositoryMovementMock = new MockMovementRepository().Queryable(); Mock <IGenericRepository <Product> > repositoryProductMock = new MockProductRepository() .GetProductByIdAsync() .UpdateProductAsync() .Queryable(); var mockUnitOfWork = new MockUnitOfWork().MovementRepository(repositoryMovementMock) .ProductRepository(repositoryProductMock) .SaveChangesAsync(); var movementService = new MovementService(mockUnitOfWork.Object, loggerMock.Object); RemoveProductWarehouse movement = new RemoveProductWarehouse { Quantity = 2, ProductId = Guid.Parse("B99BC862-C515-4D61-97D8-4D2B188A19F3"), WarehouseId = Guid.Parse("351BA5AA-C78D-4491-931A-76603D729392") }; //Act var result = await movementService.RemoveProductsOfWarehouse(movement); //Assert Assert.True(result.Equals(true)); }
static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Console() .WriteTo.File(@"\Logs\EventExperiment-EasyHub.log", rollingInterval: RollingInterval.Day, outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} {NewLine}{Exception}") .CreateLogger(); Log.Logger.Information($"Welcome to the messaging service using the Easy Message Hub."); var messageGenerator = new MessageGenerator(Log.Logger); var hub = MessageHub.Instance; var messageService = new MessageService(Log.Logger, hub); var messageType = new MessageTypeSwitchService(Log.Logger, hub); var actionService = new ActionService(Log.Logger, hub); var movementService = new MovementService(Log.Logger, hub); Parallel.For(1, 100, (x) => { Log.Logger.Information($"Item: {x}."); var message = messageGenerator.GenerateNewMessage(); messageService.SendMessage(message); var messageDetail = $"Type: {message.MessageTypes:G}, Messages: {string.Join(",", message.MessageList)}."; Log.Logger.Information(Constants.LogMessageTemplate, message.MessageId, "Program", "Main", messageDetail); }); hub.ClearSubscriptions(); Console.WriteLine("Press any key to continue."); Log.CloseAndFlush(); Console.ReadKey(); }
private void SetMag(byte[] bytes) { _mag.X = MovementService.Mag(bytes, "x"); _mag.Y = MovementService.Mag(bytes, "y"); _mag.Z = MovementService.Mag(bytes, "z"); onPropertyChanged(nameof(Mag)); }
// Start is called before the first frame update void Start() { rigidbody = GetComponent <Rigidbody2D>(); enteredCollision = false; animator = GetComponent <Animator>(); movementService = NPCMovementServiceImpl.Create(animator); }
private void SetAcc(byte[] bytes) { _acc.X = MovementService.Acc(bytes, "x"); _acc.Y = MovementService.Acc(bytes, "y"); _acc.Z = MovementService.Acc(bytes, "z"); onPropertyChanged(nameof(Acc)); }
public override void LoadContent() { _serviceContainer = new ServiceContainer(_simulationState, ScreenManager.Game.Content, ScreenManager.Game.GraphicsDevice); _serviceContainer.Map = new Map(_simulationState.MapName); _serviceContainer.Camera = new Camera2D(new Viewport(0, 0, 638, 566), (int)_serviceContainer.Map.WorldSizePixels.X, (int)_serviceContainer.Map.WorldSizePixels.Y, 1.0f); _serviceContainer.Camera.Move(new Vector2(319, 248)); _mapRenderingService = new MapRenderingService(); var spriteRenderingService = new SpriteRenderingService(); var networkInputService = new NetworkInputService(_playerID); var explosionService = new ExplosionSpriteService(); var movementService = new MovementService(_playerID); movementService.SpriteDescriptorLookup = spriteRenderingService.SpriteDescriptorLookup; var entitySyncService = new EntitySyncService(); var interfaceRenderingService = new InterfaceRenderingService(); _debugService = new DebugService(); _serviceContainer.AddService(_mapRenderingService); _serviceContainer.AddService(spriteRenderingService); _serviceContainer.AddService(networkInputService); _serviceContainer.AddService(movementService); _serviceContainer.AddService(entitySyncService); _serviceContainer.AddService(_debugService); _serviceContainer.AddService(explosionService); _serviceContainer.AddService(interfaceRenderingService); base.LoadContent(); }
private void SetGyro(byte[] bytes) { _gyro.X = MovementService.Gyro(bytes, "x"); _gyro.Y = MovementService.Gyro(bytes, "y"); _gyro.Z = MovementService.Gyro(bytes, "z"); onPropertyChanged(nameof(Gyro)); }
public async Task When_Move_Product_Other_Warehouse() { //Arrange var loggerMock = new Mock <ILogger <MovementService> >(); Mock <IGenericRepository <Movement> > repositoryMovementMock = new MockMovementRepository().Queryable(); Mock <IGenericRepository <Product> > repositoryProductMock = new MockProductRepository() .GetProductByIdAsync() .UpdateProductAsync() .Queryable(); var mockUnitOfWork = new MockUnitOfWork().MovementRepository(repositoryMovementMock) .ProductRepository(repositoryProductMock) .SaveChangesAsync(); var movementService = new MovementService(mockUnitOfWork.Object, loggerMock.Object); MoveProducts moveProducts = new MoveProducts { Quantity = 3, ProductId = Guid.Parse("B99BC862-C515-4D61-97D8-4D2B188A19F3"), CurrentWarehouseId = Guid.Parse("351BA5AA-C78D-4491-931A-76603D729392"), NewWarehouseId = Guid.Parse("C347ED5D-1F33-49EE-A58D-B7F2310192A6") }; //Act var result = await movementService.MoveProductOtherWarehouse(moveProducts); //Assert Assert.NotNull(result); Assert.True(result.ToList().Count > 0); }
public void Movement_Service_Start_With_Initialize_Should_Return_Correct_Result2() { var moveAreaMock = new Mock <IMoveArea <int> >(); moveAreaMock.SetupGet(s => s.Width).Returns(10); moveAreaMock.SetupGet(s => s.Height).Returns(10); var robo = new Robo <int, int>(moveAreaMock.Object); var service = new MovementService <int, int>(robo); robo.Step = 1; service.Initialize("PLACE 1,2,EAST"); service.ProcessCommand("MOVE"); service.ProcessCommand("MOVE"); service.ProcessCommand("LEFT"); service.ProcessCommand("MOVE"); var expectedDirection = DirectionFactory <int, int> .Create("NORTH"); robo.Direction.GetType().Should().BeSameAs(expectedDirection.GetType()); robo.Position.X.Should().Be(3); robo.Position.Y.Should().Be(3); service.ProcessCommand("MOVE"); robo.Position.X.Should().Be(3); robo.Position.Y.Should().Be(4); }
protected void Update() { MovementService.TranslateObjectVertically(this.gameObject, verticalDirection, minSpeed); MovementService.TranslateObjectHorizontally(this.gameObject, horizontalDirection, minSpeed); SetSpriteDirection(); }
public async Task When_Error_Get_Total_Shopping_Of_Product(string id) { //Arrange var loggerMock = new Mock <ILogger <MovementService> >(); Mock <IGenericRepository <Movement> > repositoryMovementMock = new MockMovementRepository().Queryable(); Mock <IGenericRepository <Product> > repositoryProductMock = new MockProductRepository() .GetProductByIdAsync() .UpdateProductAsync() .Queryable(); var mockUnitOfWork = new MockUnitOfWork().MovementRepository(repositoryMovementMock) .ProductRepository(repositoryProductMock) .SaveChangesAsync(); var movementService = new MovementService(mockUnitOfWork.Object, loggerMock.Object); Exception exception = null; //Act try { await movementService.GetTotalShoppingProduct(Guid.Parse(id)); } catch (Exception ex) { exception = ex; } //Assert Assert.True("The product is out of stock and purchases" == exception.Message); Assert.True(typeof(BusinessException) == exception.GetType()); }
private static void Main(string[] args) { string input = string.Empty; var translator = new CommandTranslator(); Grid grid = new Grid(10, 10, new Position(0, 0)); DirectionMove direction = new DirectionMove(grid); OrientationMove orientation = new OrientationMove(); var movementService = new MovementService(grid, direction, orientation); var rover = new Rover(movementService); PrintStatus(movementService); while (input != "x") { input = Console.ReadLine(); var command = translator.Parse(input); var result = rover.Move(command); if (result.IsFail) { Console.WriteLine("Obstacle detected."); } PrintStatus(movementService); } }
public UserControl GetVisualisationUserControl(IConfigurable configuration) { _antWarsViewModel = new AntWarsViewModel(); _movementService = new MovementService(_antWarsViewModel); _botService = new BotService(_antWarsViewModel); return(new AntWarsUserControl(_antWarsViewModel)); }
private void FixedUpdate() { MovementService.BoostObject(h_value + h_debuff, v_value + v_debuff, rigidBody, maxSpeed); h_value = 0; v_value = 0; }
private void Start() { rigidbody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); movementService = EnemyMovementServiceImpl.Create(animator); enemyStats = gameObject.GetComponent <EnemyStats>(); player = CharacterDecider.instance.GetCurrentCharacter(); }
private void Start() { actionScheduler = GetComponent <ActionScheduler>().Register(this); moveService = GetComponent <MovementService>(); animator = GetComponent <Animator>(); attackTriggerId = Animator.StringToHash("attack"); stopAttackTriggerId = Animator.StringToHash("stopAttack"); }
public MovementServiceTests() { numberOfSpaces = 40; gameBoard = new GameBoard(); mockEnterSpaceCommandFactory = new Mock <INullCommandFactory>(); mockLandOnSpaceCommandFactory = new Mock <INullCommandFactory>(); mockEnterSpaceNullCommand = new Mock <INullCommand>(); mockLandOnSpaceNullCommand = new Mock <INullCommand>(); player = new Player(); movementService = new MovementService(gameBoard); }
private void AddMovementService() { var movementConfig = ServiceProvider.GetService <PlayerConfig>(); var movementHelper = ServiceProvider.GetService <MovementEventRepository>(); var player = GameObject; var service = new MovementService(movementConfig, player.transform, movementHelper); Services.Add(service); }
public override void Animate() { base.Animate(); var newScale = MovementService.ChangeScale(); if (newScale.HasValue) { gameObject.transform.localScale = newScale.Value; } }
/// <summary> /// Constructor /// </summary> /// <param name="pieceColor">Chess piece colour</param> public Pawn(PieceColor pieceColor) : base(pieceColor) { // Going forward we could potentially get rid of this Pawn class and store the chess piece // type in the main ChessPiece class. Since the movement and movement validation is now handled // within the movement service we don't really need to override the move method. // Could have a ValidatorFactory or something similar to get the correct // validator depending on ChessPiece type. _validator = new PawnMoveValidator(this); _movementSerivce = new MovementService(_validator); }
public AdminController() { db = new KAIROS_SHOPEntities(); watchService = new WatchService(db); modificationService = new ModificationService(db); watchModelService = new WatchModelService(db); movementService = new MovementService(db); accountService = new AccountService(db); roleService = new RoleService(db); orderService = new OrderService(db); orderStatusService = new OrderStatusService(db); orderDetailService = new OrderDetailService(db); }
public void Movement_Service_Start_Without_Initialize_Should_Throw_Exceptions(string command, string exceptionMessage) { var moveAreaMock = new Mock <IMoveArea <int> >(); moveAreaMock.SetupGet(s => s.Width).Returns(10); moveAreaMock.SetupGet(s => s.Height).Returns(10); var robo = new Robo <int, int>(moveAreaMock.Object); var service = new MovementService <int, int>(robo); Action act = () => service.ProcessCommand(command); act.Should().Throw <InvalidOperationException>().WithMessage(exceptionMessage); }
public BoardViewModel(GameService gameService, MovementService movementService, ISubscriptionProvider subscriptionProvider) { this.gameService = gameService; this.movementService = movementService; this.subscriptionProvider = subscriptionProvider; viewPerspective = ChessColor.White; pieceMover = new PieceMover(); movesSequenceTranslator = new MoveSequenceTranslator(); movesReplayer = MovesReplayer.Create(new MovesLog()); turnsTracker = new TurnsTracker(movesReplayer.MovesLog); }
public void AddMovementWithoutProduct() { var mock = new Mock <IMovementRepository>(); var newMov = new Movement() { MovementOrigin = null }; var service = new MovementService(mock.Object); var repMov = service.AddMovement(newMov); Assert.IsTrue(repMov == null); }
private void Update() { if (Vector2.Distance(this.transform.position, player.position) <= 1.3f) { GetPrize(); } MovementService.TranslateObjectVertically(this.gameObject, 1, speed); if (this.transform.position.y > topCollider.transform.position.y) { DeactivatePrize(); } }
private void Update() { MovementService.TranslateObjectHorizontally(this.gameObject, horizontalDirection, speed); if (horizontalDirection == 1 && transform.position.x > rightEdge + offSetAfterLimit) { RecallProp(); } if (horizontalDirection == -1 && transform.position.x < leftEdge - offSetAfterLimit) { RecallProp(); } }
public void MovementofOneUserUndefined() { var mock = new Mock <IMovementRepository>(); var user = new User() { Name = "Gilbert", Email = "*****@*****.**" }; var service = new MovementService(mock.Object); var repMov = service.GetAllMovementOneUser(user); Assert.IsTrue(repMov == null); }
public void GetListAfterInventoryWithProductUndefined() { var mock = new Mock <IMovementRepository>(); var newProd = new Product() { Name = "productwithoutname" }; var service = new MovementService(mock.Object); var repMov = service.GetAllMovementOneProductAfterInventory(newProd); Assert.IsTrue(repMov == null); }
public void GivenMovementService_WhenMovementInitializedWithTwoMoves_ThenPerformMoveMovesObjectHalfAWay() { // Given var movementService = new MovementService(); var startingPosition = new Vector3(0, 0, 0); var targetPosition = new Vector3(1, 1, 1); movementService.InitializeMovementTowardsPosition(startingPosition, 2, targetPosition); // When var position = movementService.PerformMove(); // Then Assert.AreEqual(new Vector3(0.5f, 0.5f, 0.5f), position); }
public void GivenMovementService_WhenMovementInitializedWithOneMove_ThenPerformMoveMovesObjectToFinalPosition() { // Given var movementService = new MovementService(); var startingPosition = new Vector3(0, 0, 0); var targetPosition = new Vector3(1, 1, 1); movementService.InitializeMovementTowardsPosition(startingPosition, 1, targetPosition); // When var position = movementService.PerformMove(); // Then Assert.AreEqual(targetPosition, position); }