Ejemplo n.º 1
0
        public void AndTestCase4()
        {
            var left = new ExpressionSpecification<String>( x => false );
            var right = new ExpressionSpecification<String>( x => false );
            var target = new XOrSpecification<String>( left, right );

            var actual = target.And( new ExpressionSpecification<String>( x => false ) );
            var result = actual.IsSatisfiedBy( String.Empty );
            Assert.IsFalse( result );
        }
Ejemplo n.º 2
0
        public void IsSatisfiedByTest3()
        {
            var left  = new ExpressionSpecification <String>(x => false);
            var right = new ExpressionSpecification <String>(x => false);

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedBy(String.Empty);

            Assert.False(actaul);
        }
Ejemplo n.º 3
0
        public void XOrTest4()
        {
            var left   = new ExpressionSpecification <String>(x => false);
            var right  = new ExpressionSpecification <String>(x => false);
            var target = new XOrSpecification <String>(left, right);

            var actual = target.XOr(new ExpressionSpecification <String>(x => false));
            var result = actual.IsSatisfiedBy(String.Empty);

            Assert.False(result);
        }
Ejemplo n.º 4
0
        public void IsSatisfiedByWithMessagesTest6()
        {
            var left  = new ExpressionSpecification <String>(x => true, "msgLeft");
            var right = new ExpressionSpecification <String>(x => false, "msgRight");

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedByWithMessages(String.Empty)
                         .ToList();

            Assert.Empty(actaul);
        }
Ejemplo n.º 5
0
        public void AndTestCaseNullCheck()
        {
            var left = new ExpressionSpecification<String>( x => false );
            var right = new ExpressionSpecification<String>( x => false );
            var target = new XOrSpecification<String>( left, right );

            ExpressionSpecification<String> other = null;
            Action test = () => target.And( other );

            test.ShouldThrow<ArgumentNullException>();
        }
Ejemplo n.º 6
0
        public void IsSatisfiedByWithMessagesTest2()
        {
            var left  = new ExpressionSpecification <String>(x => true);
            var right = new ExpressionSpecification <String>(x => false);

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedByWithMessages(String.Empty)
                         .ToList();

            Assert.Equal(0, actaul.Count);
        }
Ejemplo n.º 7
0
        public void XOrTestNullCheck()
        {
            var left   = new ExpressionSpecification <String>(x => false);
            var right  = new ExpressionSpecification <String>(x => false);
            var target = new XOrSpecification <String>(left, right);

            ExpressionSpecification <String> other = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.XOr(other);

            test.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 8
0
        public void IsSatisfiedByWithMessagesTest4()
        {
            var left  = new ExpressionSpecification <String>(x => true, "msgLeft");
            var right = new ExpressionSpecification <String>(x => true, "msgRight");

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedByWithMessages(String.Empty)
                         .ToList();

            Assert.Single(actaul);
            Assert.Equal("The given object matches both specifications.", actaul[0]);
        }
Ejemplo n.º 9
0
        public void IsSatisfiedByWithMessagesTest()
        {
            var left  = new ExpressionSpecification <String>(x => true);
            var right = new ExpressionSpecification <String>(x => true);

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedByWithMessages(String.Empty)
                         .ToList();

            Assert.Equal(1, actaul.Count);
            Assert.Equal(actaul[0], "The given object matches both specifications.");
        }
Ejemplo n.º 10
0
        public void IsSatisfiedByWithMessagesTest7()
        {
            var left  = new ExpressionSpecification <String>(x => false, "msgLeft");
            var right = new ExpressionSpecification <String>(x => false, "msgRight");

            var target = new XOrSpecification <String>(left, right);
            var actaul = target.IsSatisfiedByWithMessages(String.Empty)
                         .ToList();

            Assert.Equal(2, actaul.Count);
            Assert.Equal(1, actaul.Count(x => x == "msgLeft"));
            Assert.Equal(1, actaul.Count(x => x == "msgRight"));
        }
Ejemplo n.º 11
0
        public void XOrTestCase()
        {
            var left = new ExpressionSpecification<String>( x => true );
            var right = new ExpressionSpecification<String>( x => true );
            var target = new XOrSpecification<String>( left, right );

            var actual = target.XOr( new ExpressionSpecification<String>( x => true ) );
            var result = actual.IsSatisfiedBy( String.Empty );
            Assert.IsTrue( result );
        }
Ejemplo n.º 12
0
        public void IsSatisfiedByWithMessagesTestCase7()
        {
            var left = new ExpressionSpecification<String>( x => false, "msgLeft" );
            var right = new ExpressionSpecification<String>( x => false, "msgRight" );

            var target = new XOrSpecification<String>( left, right );
            var actaul = target.IsSatisfiedByWithMessages( String.Empty )
                               .ToList();
            Assert.AreEqual( 2, actaul.Count );
            Assert.AreEqual( 1, actaul.Count( x => x == "msgLeft" ) );
            Assert.AreEqual( 1, actaul.Count( x => x == "msgRight" ) );
        }
Ejemplo n.º 13
0
        public void IsSatisfiedByWithMessagesTestCase4()
        {
            var left = new ExpressionSpecification<String>( x => true, "msgLeft" );
            var right = new ExpressionSpecification<String>( x => true, "msgRight" );

            var target = new XOrSpecification<String>( left, right );
            var actaul = target.IsSatisfiedByWithMessages( String.Empty )
                               .ToList();
            Assert.AreEqual( 1, actaul.Count );
            Assert.AreEqual( actaul[0], "The given object matches both specifications." );
        }
Ejemplo n.º 14
0
        public void IsSatisfiedByWithMessagesTestCase3()
        {
            var left = new ExpressionSpecification<String>( x => false );
            var right = new ExpressionSpecification<String>( x => false );

            var target = new XOrSpecification<String>( left, right );
            var actaul = target.IsSatisfiedByWithMessages( String.Empty )
                               .ToList();
            Assert.AreEqual( 2, actaul.Count );
            Assert.IsNull( actaul[0] );
            Assert.IsNull( actaul[1] );
        }
Ejemplo n.º 15
0
        public void IsSatisfiedByTestCase3()
        {
            var left = new ExpressionSpecification<String>( x => false );
            var right = new ExpressionSpecification<String>( x => false );

            var target = new XOrSpecification<String>( left, right );
            var actaul = target.IsSatisfiedBy( String.Empty );
            Assert.IsFalse( actaul );
        }