/*
         *  Summary: Displays the add payment type menu to the user
         */
        public void Show()
        {
            // Both fields must contain value
            do
            {
                Console.Clear();
                Console.WriteLine("Enter payment type (e.g. AmEx, Visa, Checking)");
                Console.Write("> ");
                _paymentType.Type = Console.ReadLine();
            } while (_paymentType.Type.Length == 0);

            do
            {
                Console.WriteLine("Enter account number");
                Console.Write("> ");
                _paymentType.AccountNumber = Convert.ToInt64(Console.ReadLine());
            } while (_paymentType.AccountNumber < 0);

            // Adds the payment type to the database, takes the active customer ID, returns the added payment type ID
            int id = _paymentTypeManager.AddNewPaymentType(_paymentType, _activeCustormerId);

            // Checks if the payment was added successfully. 0 == failure
            if (id > 0)
            {
                Console.WriteLine($"*** {_paymentType.Type} PAYMENT TYPE ADDED FOR {_activeCustomerName} ***");
                Console.WriteLine("*** PRESS ENTER TO CONTINUE ***");
                Console.ReadLine();
            }
        }
        public void CloseOrder()
        {
            // add customer to DB and get id
            int CustomerId = _customerManager.AddCustomer(_customer);

            // add the customerId to _testOrder
            _testOrder.CustomerId = CustomerId;
            // add the customerId to _testProduct
            _testProduct.CustomerId = CustomerId;

            // Variable initialization for Payment Type
            _paymentType1 = new PaymentType();
            // Adds properties to the _paymentType instance
            _paymentType1.Type          = "Mastercard";
            _paymentType1.AccountNumber = 12345678910;

            // add a test order
            int orderId = _orderManager.AddOrder(_testOrder);
            // add a test product
            int productId = _productManager.AddProduct(_testProduct);

            // Adds the _paymentType to the _paymentList in the paymentTypeManager, passes in a customerId
            int paymentId = _paymentTypeManager.AddNewPaymentType(_paymentType1, CustomerId);

            // get the user's unpaid order
            Order customerOrder = _orderManager.GetUnpaidOrder(CustomerId);

            // Close the order by adding the payment type selected
            _orderManager.CloseOrder(customerOrder.Id, paymentId);

            // retrieve the order and Assert that the updated values match
            Order retrievedOrder = _orderManager.GetOrderById(orderId);

            // Get the payment type info used on the order
            // since PaymentTypeId is currently a nullable int type, convert it to an int to use it to retrieve the payment Type details
            int         retrievedPaymentTypeId = retrievedOrder.PaymentTypeId ?? default(int);
            PaymentType retrievedPaymentType   = _paymentTypeManager.GetSinglePaymentType(retrievedPaymentTypeId);

            // Assert that the payment type matches what we used to close the order
            Assert.Equal("Mastercard", retrievedPaymentType.Type);
            Assert.Equal(12345678910, retrievedPaymentType.AccountNumber);
        }
        public void AddNewPaymentType_Should()
        {
            // Variable initializations
            _paymentType1 = new PaymentType();
            _testCustomer = new Customer();

            // Add a test customer to get the returned ID
            int custId = _custManager.AddCustomer(_testCustomer);

            // Adds properties to the _paymentType instance
            _paymentType1.Type          = "Mastercard";
            _paymentType1.AccountNumber = 12345678910;

            // Adds the _paymentType to the _paymentList in the paymentTypeManager, passes in a customerId
            int paymentId = _paymentTypeManager.AddNewPaymentType(_paymentType1, custId);

            // Asserts the properties exist
            PaymentType payment = _paymentTypeManager.GetSinglePaymentType(paymentId);

            Assert.Equal(payment.Id, paymentId);
            Assert.Equal(payment.CustomerId, custId);
            Assert.Equal(payment.Type, "Mastercard");
            Assert.Equal(payment.AccountNumber, 12345678910);
        }
        public void AddNewPaymentType()
        {
            // Sets the current customer so a payment type can be added
            Customer _currentCustomer = new Customer();

            _currentCustomer.customerID     = 1;
            _currentCustomer.firstName      = "Brain";
            _currentCustomer.lastName       = "Pinky";
            _currentCustomer.streetAddress  = "114 Street Place";
            _currentCustomer.state          = "Tennesseetopia";
            _currentCustomer.postalCode     = 55555;
            _currentCustomer.phoneNumber    = "555-123-4567";
            CustomerManager.currentCustomer = _currentCustomer;

            PaymentType newPaymentType = new PaymentType()
            {
                accountNumber = 12345, name = "Visa"
            };

            int paymentTypeID = _ptm.AddNewPaymentType(newPaymentType);

            Assert.True(paymentTypeID != 0);
        }