Example #1
0
        public void ToString_ReturnsProductAndImportedAndTaxExempt_Test()
        {
            var      expected = "1 product at $price";
            IProduct iProduct = Mock.Create <Product>();

            Mock.Arrange(() => iProduct.ToString()).Returns("product at $price");

            var sut = new TransactionItem()
            {
                ProductPurchased = iProduct, Quantity = 1
            };


            var actual = sut.ToString();

            Assert.That(actual, Is.EqualTo(expected));
        }
        private void DisplayListDetails()
        {
            List <TransactionItem> _alist2 = new List <TransactionItem>();
            string bigstring = textBox_Display.Text;

            bigstring.Replace('\r', '\0');
            string[] _alist3 = bigstring.Split('\n');
            for (int i = 1; i < _alist3.Length - 1; i++)
            {
                if (_alist3[i].Length < 5)
                {
                    continue;
                }
                String[] t_strings = _alist3[i].Split(',');
                //  textBox_Display.Text += _alist3[i] + "\r\n";
                TransactionItem t_item = new TransactionItem(t_strings);
                _alist2.Add(t_item);
            }
            double[] totals = new double[10];
            //    if (comboBox_SelectedTrans.SelectedIndex < 0)
            //        comboBox_SelectedTrans.SelectedIndex = 1;
            //  DisplaySpecificEmployeeInfo(comboBox_SelectedTrans.SelectedIndex);
            //DisplayHeadings();

            foreach (TransactionItem t_item in _alist2)
            {
                int typeIndex = t_item.RecordType;
                if (t_item.RecordType < 0)
                {
                    typeIndex = 2;
                }
                listBox1.Items.Add(t_item.ToString(typeIndex));
                totals[typeIndex] += t_item.Total;
            }
            listBox1.Items.Add(String.Format("{0,56} {1,14}        {2,14}", "  ", "-------", "-------"));
            listBox1.Items.Add(String.Format("{0,56} {1,14:C}      {2,16:C}", "  ", totals[1], totals[2]));
            listBox1.Items.Add("  "); listBox1.Items.Add("  "); listBox1.Items.Add("  ");
        }