예제 #1
0
        public void GroupByNames_PopulatedList_ReturnsGroupedDictionary()
        {
            var catReport = new CategoriesWithQuantityReport();

            Items items = new Items();
            var   item  = new Item()
            {
                Name     = "TestName",
                Quantity = 2
            };

            var item2 = new Item()
            {
                Name     = "TestName",
                Quantity = 2
            };

            items.ListOfItems.Add(item);
            items.ListOfItems.Add(item2);

            var result = catReport.GroupByNames(items);

            Assert.IsTrue(result.ContainsKey("TestName"));
            Assert.IsTrue(result["TestName"] == 4);
        }
예제 #2
0
        public void GroupByNames_EmptyList_ReturnsEmptyDictionary()
        {
            var catReport = new CategoriesWithQuantityReport();

            Items items  = new Items();
            var   result = catReport.GroupByNames(items);

            Assert.IsTrue(result.Keys.Count == 0);
        }