示例#1
0
        public async void unit_test_getBalance(string uid, int amount)
        {
            //Arrange
            var context  = new Mock <HttpContext>();
            var identity = new GenericIdentity("");

            identity.AddClaim(new Claim(ClaimTypes.Name, uid));
            var principal = new GenericPrincipal(identity, new[] { "" });

            context.Setup(s => s.User).Returns(principal);

            _uut.ControllerContext.HttpContext = context.Object;
            WalletEntity test = new WalletEntity()
            {
                Amount = amount
            };

            //Act
            _uut.CreateWallet(test);
            var result = await _uut.getBalance();

            var okResult = result as OkObjectResult;
            var content  = okResult.Value;

            //Assert
            Xunit.Assert.Equal(amount, content);
        }
        public async Task CanCreateWalletAsync()
        {
            CreateWalletCommand command = new CreateWalletCommand
            {
                Name       = "default",
                Timestamp  = 1605037286186,
                CustomerId = "asd1212112qx"
            };

            Assert.NotNull((await walletController.CreateWallet(command)).Value);
        }
示例#3
0
 public void CreateWallet(Wallet wallet)
 {
     wCtr.CreateWallet(wallet);
 }