Beispiel #1
0
        public void TEST_IsSatisfiedBy_GIVEN_True_EXPECT_True()
        {
            // Arrange
            var target = new IsTrueSpecification();

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

            // Assert
            Assert.True(result);
        }
Beispiel #2
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));
        }
        public void TEST_Or_GIVEN_NoneSpecification_EXPECT_IsSatisfiedByOther()
        {
            // Arrange
            var none       = Specification <bool> .None;
            var isTrueSpec = new IsTrueSpecification();

            // Act
            // Assert
            Assert.Equal(none.Or(isTrueSpec).IsSatisfiedBy(true), isTrueSpec.IsSatisfiedBy(true));
            Assert.Equal(isTrueSpec.Or(none).IsSatisfiedBy(true), isTrueSpec.IsSatisfiedBy(true));
            Assert.Equal(none.Or(isTrueSpec).IsSatisfiedBy(false), isTrueSpec.IsSatisfiedBy(false));
            Assert.Equal(isTrueSpec.Or(none).IsSatisfiedBy(false), isTrueSpec.IsSatisfiedBy(false));
        }
        public void TEST_And_GIVEN_NoneSpecification_EXPECT_ToNotSatisfy()
        {
            // Arrange
            var none       = Specification <bool> .None;
            var isTrueSpec = new IsTrueSpecification();

            // Act
            // Assert
            Assert.False(none.And(isTrueSpec).IsSatisfiedBy(true));
            Assert.False(isTrueSpec.And(none).IsSatisfiedBy(true));
            Assert.False(none.And(isTrueSpec).IsSatisfiedBy(false));
            Assert.False(isTrueSpec.And(none).IsSatisfiedBy(false));
        }