예제 #1
0
        public void GetTotalTurnover_NegativeInts_ReturnsProperValue()
        {
            TransactionLibrary library      = new TransactionLibrary();
            List <Transaction> transactions = new List <Transaction>();

            transactions.Add(new Transaction()
            {
                Id             = 1,
                ProductHistory = new List <ProductHistory>()
                {
                    new ProductHistory()
                    {
                        Price = -1
                    },
                    new ProductHistory()
                    {
                        Price = -3
                    }
                }
            });
            transactions.Add(new Transaction()
            {
                Id             = 2,
                ProductHistory = new List <ProductHistory>()
                {
                    new ProductHistory()
                    {
                        Price = -2.50
                    }
                }
            });

            var result = library.GetTotalTurnover(new EnumerableQuery <Transaction>(transactions));

            Assert.IsTrue(result <-6.49 && result> -6.51);
        }