Пример #1
0
        public void TEST_And_GIVEN_IdentitySpecification_EXPECT_ToReturnOther()
        {
            // Arrange
            var all         = Specification <bool> .All;
            var isFalseSpec = new IsFalseSpecification();

            // Act
            // Assert
            Assert.Same(all.And(isFalseSpec), isFalseSpec);
            Assert.Same(isFalseSpec.And(all), isFalseSpec);
        }
Пример #2
0
        public void TEST_Or_GIVEN_IdentitySpecification_EXPECT_ToReturnIdentitySpecification()
        {
            // Arrange
            var all         = Specification <bool> .All;
            var isFalseSpec = new IsFalseSpecification();

            // Act
            // Assert
            Assert.Same(all.Or(isFalseSpec), all);
            Assert.Same(isFalseSpec.Or(all), all);
        }
Пример #3
0
        public void TEST_IsSatisfiedBy_GIVEN_True_EXPECT_False()
        {
            // Arrange
            var target = new IsFalseSpecification();

            // Act
            var result = target.IsSatisfiedBy(true);

            // Assert
            Assert.False(result);
        }
Пример #4
0
        public void TEST_Not_GIVEN_Specification_EXPECT_ToReturnInversedSpecification()
        {
            // Arrange
            var isFalseSpec = new IsFalseSpecification();

            // Act
            var target = isFalseSpec.Not();

            // Assert
            Assert.True(target.IsSatisfiedBy(true));
            Assert.True(target.ToExpression().Compile()(true));
        }
Пример #5
0
        public void TEST_Or_GIVEN_TwoSpecifications_EXPECT_ToCombine()
        {
            // Arrange
            var isTrueSpec  = new IsTrueSpecification();
            var isFalseSpec = new IsFalseSpecification();

            // Act
            var target = isTrueSpec.Or(isFalseSpec);

            // Assert
            Assert.True(target.IsSatisfiedBy(true));
            Assert.True(target.ToExpression().Compile()(true));
        }