public async Task <IActionResult> TransferCharacter([FromForm] TransferCharacterRequest request)
        {
            var response = await mediator.Send(request);

            Log.Information(
                $"User #{HttpContext.GetCurrentUserId()} transfered their character #{request.SourceCharacterId} to character #{request.TargetCharacterId}");

            return(this.CreateResponse(response));
        }
Example #2
0
        public void SetUp()
        {
            request = new TransferCharacterRequest {
                SourceCharacterId = 1, TargetCharacterId = 2
            };

            premiumAccountManager = new Mock <IPremiumAccountManager>();
            premiumCreditsDatabaseRestorePoint = new Mock <IPremiumCreditsDatabaseRestorePoint>();
            httpContextReader = new Mock <IHttpContextReader>();

            premiumAccountManager.Setup(p => p.TransferCharacter(request.SourceCharacterId, request.TargetCharacterId))
            .ReturnsAsync(true);
            premiumCreditsDatabaseRestorePoint.Setup(pcd =>
                                                     pcd.CreateRestoreParams(It.IsAny <IDatabaseRestoreParams>())
                                                     .EnqueueToConnectionDatabaseRestorePoints(It.IsAny <string>()))
            .Returns(premiumCreditsDatabaseRestorePoint.Object);

            transferCharacterCommand = new TransferCharacterCommand(premiumAccountManager.Object,
                                                                    premiumCreditsDatabaseRestorePoint.Object, httpContextReader.Object);
        }