Exemplo n.º 1
0
        public void Index_ReturnsViewResult_WhenLoginSucceeded()
        {
            // Arrange
            var controller = new UserTransactionsController(new UserManager(new UsersRepository()), new UsersRepository());
            var newUser    = new Users
            {
                AccountNumber = "123456789123456"
            };

            // Act
            var result = controller.Index("123456789123456");

            // Assert

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.True(string.IsNullOrEmpty(viewResult.ViewName));
        }
Exemplo n.º 2
0
        public void Users_ReturnsFalse_WhenBalancesIsnotEqualToDB()
        {
            // Arrange
            var controller = new UserTransactionsController(new UserManager(new UsersRepository()), new UsersRepository());
            var oldUser    = new Users
            {
                AccountNumber = "123456789123456",
                Balance       = 500
            };
            double CurrBalance = 1000;
            // Act
            var result = controller.CheckBalance(oldUser.AccountNumber, CurrBalance);

            // Assert

            var okResult = Assert.IsType <bool>(result);

            Assert.False(okResult, "false");
        }
Exemplo n.º 3
0
        public void InsertTrans_ReturnsOkObjectResult_WhenSuccess()
        {
            // Arrange
            var controller   = new UserTransactionsController(new UserManager(new UsersRepository()), new UsersRepository());
            var newUserTrans = new UserTransactions
            {
                AccountNumber = "123456789123456",
                Amount        = 100,
                TransType     = "Deposit",
                TransBy       = "123456789123456"
            };

            // Act
            var result = controller.InsertTrans(newUserTrans);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(result);

            Assert.Equal(200, okResult.StatusCode);
        }