예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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]);
        }
예제 #4
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.");
        }
예제 #5
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"));
        }
예제 #6
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" ) );
        }
예제 #7
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." );
        }
예제 #8
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] );
        }