Exemple #1
0
        public void AddProductCategoryTest()
        {
            var context = new Mock <IProductCatalogueContext>();
            var service = new CatalogueManagementService(context.Object);

            service.AddProductCategory();
        }
Exemple #2
0
        public void GetProductCategories_EmptyCollection_ReturnsEmptyCollection()
        {
            var context = new Mock <IProductCatalogueContext>();

            context.Setup(c => c.Categories).ReturnsEntitySet(new ProductCategory[0]);
            var service = new CatalogueManagementService(context.Object);

            var categories = service.GetProductCategories();

            Assert.Equal(0, categories.Count);
        }
Exemple #3
0
        public void GetProductCategories_CollectionWithOneElement_ReturnsCollectionWithOneElement()
        {
            var context           = new Mock <IProductCatalogueContext>();
            int id                = 1;
            var initialCategories = new ProductCategory[1] {
                new ProductCategory()
                {
                    Id = id
                }
            };

            context.Setup(c => c.Categories).ReturnsEntitySet(initialCategories);
            var service = new CatalogueManagementService(context.Object);

            var categories = service.GetProductCategories();

            Assert.Equal(id, categories.Count);
            Assert.Contains(categories, c => c.Id == id);
        }