Ejemplo n.º 1
0
        public void Combine_ThrowsException_IfItemsAreDifferent()
        {
            EachesGroceryItem soup  = new EachesGroceryItem("soup", 1.89M);
            EachesGroceryItem bread = new EachesGroceryItem("bread", 2.30M);

            EachesGroceryItemOrder a = new EachesGroceryItemOrder(soup, 3);
            EachesGroceryItemOrder b = new EachesGroceryItemOrder(bread, 6);

            Assert.ThrowsException <DifferingItemsException>(() => a.Combine(b));
        }
Ejemplo n.º 2
0
        public void AbstractCombine_ReturnsNewEachesGroceryItemWithCombinedCount()
        {
            EachesGroceryItem item = new EachesGroceryItem("soup", 2.00M);
            IGroceryItemOrder a    = new EachesGroceryItemOrder(item, 3);
            IGroceryItemOrder b    = new EachesGroceryItemOrder(item, 6);

            EachesGroceryItemOrder result = (EachesGroceryItemOrder)a.Combine(b);

            Assert.AreEqual(9, result.Count);
        }