コード例 #1
0
        public async void unit_test_update()
        {
            //Arrange
            var context  = new Mock <HttpContext>();
            var identity = new GenericIdentity("test");

            identity.AddClaim(new Claim(ClaimTypes.Name, "f8ac5f4b-d637-4bc4-acd2-cd940663f3ef"));
            var principal = new GenericPrincipal(identity, new[] { "User" });

            context.Setup(s => s.User).Returns(principal);
            _uut.ControllerContext.HttpContext = context.Object;

            WalletEntity test = new WalletEntity()
            {
                Amount = 0,
                card   = new CardEntity()
                {
                    CardNumber  = 10210310310310,
                    ExpireMonth = 02,
                    ExpireYear  = 2052,
                    CVVnumber   = 211
                }
            };

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

            //Assert
            Xunit.Assert.IsType <OkResult>(result);
        }