Ejemplo n.º 1
0
        public void Active_Should_Throw_ArgumentNullException_If_Categories_Is_Null()
        {
            IQueryable<Category> categories = null;

            var ex = Assert.Throws<ArgumentNullException>(() => CategoryExtensions.Active(categories));
            Assert.Equal(nameof(categories), ex.ParamName);
        }
Ejemplo n.º 2
0
        public void Active_Should_Return_Only_Categories_Not_Deleted()
        {
            var c1 = Category.Create("c1", "c1", "c1");
            var c2 = Category.Create("c2", "c2", "c2");
            var c3 = Category.Create("c3", "c3", "c3");
            c3.Delete();

            IQueryable<Category> categories = new Category[]
            {
                c1, c2, c3
            }.AsQueryable();

            var activeCategories = CategoryExtensions.Active(categories).ToArray();
            Assert.True(activeCategories.All(c => !c.Deleted));
        }