Example #1
0
        public void TestOrSpecification(int a, int b, bool result)
        {
            var aSpec = new PositiveSignSpecification(a);
            var bSpec = new PositiveSignSpecification(b);

            aSpec.Or(bSpec).IsSatisfiedBy(42).Should().Be(result);
        }
Example #2
0
        public void TestNotSpecificationQuery()
        {
            var spec = new PositiveSignSpecification(1);
            var q    = Query().SelectAllFrom("test");

            spec.Not().ApplyQueryBuilder(q);

            q.ToUnsafeSql().Should().Be("select test.* from test where not (number > 0)");
        }
Example #3
0
        public void TestOrSpecificationQuery()
        {
            var aSpec = new PositiveSignSpecification(1);
            var bSpec = new PositiveSignSpecification(-1);

            var q = Query().SelectAllFrom("test");

            aSpec.Or(bSpec).ApplyQueryBuilder(q);

            q.ToUnsafeSql().Should().Be("select test.* from test where number > 0 or number < 0");
        }
Example #4
0
        public void TestNotSpecification(int input, bool result)
        {
            var spec = new PositiveSignSpecification(input);

            spec.Not().IsSatisfiedBy(42).Should().Be(result);
        }