Example #1
0
 public void DisplayUserBuysProduct(int count, BuyTransaction transaction)
 {
     Console.WriteLine($"proukter købt:");
     for (int i = 0; i < count; i++)
     {
         Console.WriteLine(transaction.ToString());
     }
 }
Example #2
0
        public void BuyTransaction_CallToString_ReturnsString()
        {
            const decimal amount  = 10;
            Product       product = Substitute.For <Product>("Milk", amount);
            User          user    = Substitute.For <User>(userArgs);

            BuyTransaction transaction = new BuyTransaction(user, product);

            Assert.That(transaction.ToString(), Is.TypeOf <string>());
        }
Example #3
0
        public void ToString_BuyTransAction_ShouldReturnString(string desc)
        {
            //arrange
            User           user   = new User();
            Product        A      = new Product(id: 1, name: "A ", price: 10);
            DateTime       date   = Convert.ToDateTime("1 / 1 / 2020");
            Guid           id     = Guid.NewGuid();
            decimal        amount = 20;
            BuyTransaction tr     = new BuyTransaction(user: user, product: A, date: date, id: id, amount: amount);

            string expected = $"{date};{id};Buy;{user};{A};{amount}";
            //act
            string actual = tr.ToString();

            //assert
            Assert.AreEqual(expected, actual, desc);
        }
Example #4
0
 public void DisplayUserBuysProduct(BuyTransaction transaction)
 {
     Console.WriteLine(transaction.ToString());
 }