Exemplo n.º 1
0
        public async Task Return_NotNull_Model_When_Cash_Found()
        {
            var databaseName = nameof(Return_NotNull_Model_When_Cash_Found);

            var options = CashRegisterService_Utilities.GetOptions(databaseName);

            CashRegisterService_Utilities.FillContextWithUserData(options);

            using (var actAndAssertContext = new CashRegisterContext(options))
            {
                var sut = new CashRegisterService(actAndAssertContext);

                var response = await sut.TotalAmountAvailable();

                Assert.IsNotNull(response.Model);
            };
        }
Exemplo n.º 2
0
        public async Task Return_Correct_Instance_Of_Model_When_Successful()
        {
            var databaseName = nameof(Return_Correct_Instance_Of_Model_When_Successful);

            var options = CashRegisterService_Utilities.GetOptions(databaseName);

            CashRegisterService_Utilities.FillContextWithUserData(options);

            using (var actAndAssertContext = new CashRegisterContext(options))
            {
                var sut = new CashRegisterService(actAndAssertContext);

                var response = await sut.TotalAmountAvailable();

                Assert.IsInstanceOfType(response, typeof(GeneralResponseModel <BanknotesDTO>));
            };
        }
        public async Task Return_OK_Status_Code_When_Successful()
        {
            var databaseName = nameof(Return_OK_Status_Code_When_Successful);

            var options = CashRegisterService_Utilities.GetOptions(databaseName);

            CashRegisterService_Utilities.FillContextWithUserData(options);

            using (var actAndAssertContext = new CashRegisterContext(options))
            {
                var sut = new CashRegisterService(actAndAssertContext);

                var response = await sut.CalculateChange(6, 8);

                Assert.IsTrue(response.StatusCode == 200);
            };
        }
        public async Task Return_Not_Null_Model_When_Successful()
        {
            var databaseName = nameof(Return_Not_Null_Model_When_Successful);

            var options = CashRegisterService_Utilities.GetOptions(databaseName);

            CashRegisterService_Utilities.FillContextWithUserData(options);

            using (var actAndAssertContext = new CashRegisterContext(options))
            {
                var sut = new CashRegisterService(actAndAssertContext);

                var response = await sut.Withdraw(50);

                Assert.IsNotNull(response.Model);
            };
        }
        public async Task Return_Failure_Message_When_Withdraw_Amount_Bigger_Than_Banknotes_Sum()
        {
            var databaseName = nameof(Return_Failure_Message_When_Withdraw_Amount_Bigger_Than_Banknotes_Sum);

            var options = CashRegisterService_Utilities.GetOptions(databaseName);

            CashRegisterService_Utilities.FillContextWithUserData(options);

            using (var actAndAssertContext = new CashRegisterContext(options))
            {
                var sut = new CashRegisterService(actAndAssertContext);

                var withdrawAmount = 99999;
                var response       = await sut.HandleCashWithdraw(withdrawAmount);

                Assert.IsTrue(response.Message == Messages.CashNotEnoughToWithdraw);
            };
        }