public void GetProfit_MixedTransactions_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 = 2 } }, TransactionType = TransactionType.Sold }); transactions.Add(new Transaction() { Id = 2, ProductHistory = new List <ProductHistory>() { new ProductHistory() { Price = 2.50 } }, TransactionType = TransactionType.Bought }); var result = library.GetProfit(new EnumerableQuery <Transaction>(transactions)); Assert.IsTrue(result <-0.49 && result> -0.51); }