Exemplo n.º 1
0
        public void FindByNotCompositeSpecification()
        {
            var product = new Product {
                Price = 99, Name = "Windows XP Professional"
            };
            var spec = new SpecificationQueryStrategy <Product>(p => p.Price < 100).Not();

            Assert.False(spec.IsSatisfiedBy(product));

            product.Price = 100;

            Assert.True(spec.IsSatisfiedBy(product));
        }
Exemplo n.º 2
0
        public void FindBySpecification()
        {
            var product = new Product {
                Price = 99
            };
            var spec = new SpecificationQueryStrategy <Product>(p => p.Price < 100);

            Assert.True(spec.IsSatisfiedBy(product));

            product.Price = 100;

            Assert.False(spec.IsSatisfiedBy(product));
        }