Example #1
0
        //Removing Should trigger PropertyChanged for Items and Price

        public void RemoveShouldTriggerPropertyChanged(string property)
        {
            var order = new Order();
            var item  = new MockOrderItem();

            Assert.PropertyChanged(order, property, () => order.Remove(item));
        }
Example #2
0
        public void AddingItemsInvokesPropertyChangedOnSubtotal()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            Assert.PropertyChanged(order, "Subtotal", () => order.Add(item));
        }
Example #3
0
        public void AddedIOrderItemsAppearInItemsProperty()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            Assert.Contains(item, order.Items);
        }
Example #4
0
        public void ShouldBeAbleToRemoveItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Remove(item);
            Assert.DoesNotContain(item, order.Items);
        }
Example #5
0
        public void ShouldBeAbleToAddItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            Assert.Contains(item, order.Items);
        }
Example #6
0
        public void RemovingItemsInvokesPropertyChangedOnItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Items.Add(item);
            Assert.PropertyChanged(order, "Items", () => order.Remove(item));
        }
Example #7
0
        public void RemovedOrderItemDoesNotAppearInItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            order.Remove(item);
            Assert.DoesNotContain(item, order.Items);
        }
Example #8
0
        public void RemovedIOrderItemsNoLongerAppearInItemsProperty()
        {
            var order = new Order(1);
            var item  = new MockOrderItem();

            order.Add(item);
            order.Remove(item);
            Assert.DoesNotContain(item, order.Items);
        }
Example #9
0
        public void AddedIOrderItemsAppearInItemsProperty()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            Assert.Contains(item, order.Items);
            //checks if memory address is the same
        }
Example #10
0
        public void AddingAnItemShouldTriggerPropertyChangedForPrice(string propertyName)
        {
            var order = new Order();
            var item  = new MockOrderItem();

            Assert.PropertyChanged(order, propertyName, () =>
            {
                order.Add(item);
            });
        }
Example #11
0
        public void ShouldBeAbleToGetEnumerationOfItems()
        {
            var order = new Order();
            var item0 = new MockOrderItem();
            var item1 = new MockOrderItem();
            var item2 = new MockOrderItem();

            order.Add(item0);
            order.Add(item1);
            order.Add(item2);
            Assert.Collection(order.Items,
                              item => Assert.Equal(item0, item),
                              item => Assert.Equal(item1, item),
                              item => Assert.Equal(item2, item));
        }