示例#1
0
        public void TestInsufficientVegetableQuantity()
        {
            Refrigerator refrigerator = new Refrigerator();
            Tomato       tomato       = new Tomato();

            refrigerator.AddVegetable(tomato, 20);
            refrigerator.SetMinimumQuantity(tomato, 8);
            refrigerator.TakeOutVegetable(tomato, 15);

            var expectedInsufficientVegetableQuantity = new List <KeyValuePair <Vegetable, int> >();

            expectedInsufficientVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 3));
            var actualInsufficientVegetableQuantity = refrigerator.GetAllInsufficientVegetables();

            Assert.Equal(expectedInsufficientVegetableQuantity.OrderBy(x => x.Key.Name), actualInsufficientVegetableQuantity.OrderBy(x => x.Key.Name));
        }