コード例 #1
0
        public void ShouldBeAbleToAddItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            Assert.Contains(item, order.Items);
        }
コード例 #2
0
        public void AddedOrderItemsAppearInItemsProperty()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            Assert.Contains(item, order.Items);
        }
コード例 #3
0
        public void ShouldBeAbleToRemoveItems()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            order.Remove(item);
            Assert.DoesNotContain(item, order.Items);
        }
コード例 #4
0
        public void RemovedOrderItemDoesNotAppearInItemsProperty()
        {
            var order = new Order();
            var item  = new MockOrderItem();

            order.Add(item);
            order.Remove(item);
            Assert.DoesNotContain(item, order.Items);
        }
コード例 #5
0
        public void RemovingAnItemShouldTriggerPropertyChanged(string propertyName)
        {
            var order = new Order();
            var item  = new MockOrderItem();

            Assert.PropertyChanged(order, propertyName, () =>
            {
                order.Remove(item);
            });
        }
コード例 #6
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));
        }