public void NotForFuncTest()
        {
            var funcCalled = false;
            var target     = new CreateInstanceOptions <String>();

            target.WithFactory(x => "test");
            var actual = target.NotFor(x =>
            {
                funcCalled = true;
                return(x.AllMembers());
            });

            funcCalled.Should()
            .BeTrue();

            actual.Should()
            .BeSameAs(target);

            var factory = target.Factories.First();

            factory.SelectionRules.Count.Should()
            .Be(1);
            var rule = factory.SelectionRules.First() as AllMemberSelectionRule;

            rule.Should()
            .NotBeNull();
        }
        public void WithFactoryArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IMemberInformation, Object> factory = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.WithFactory(factory);

            test.ShouldThrow <ArgumentNullException>();
        }
        public void NotForPredicateArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();

            target.WithFactory(x => "test");
            Func <IMemberInformation, Boolean> predicate = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.NotFor(predicate);

            test.ShouldThrow <ArgumentNullException>();
        }
        public void NotForFuncArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();

            target.WithFactory(x => "test");
            Func <IIncludeExcludeOptions <String>, IIncludeExcludeOptions <String> > configurationFunc = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.NotFor(configurationFunc);

            test.ShouldThrow <ArgumentNullException>();
        }
        public void WithFactoryTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IMemberInformation, Object> factory = x => "test";
            var actual = target.WithFactory(factory);

            actual.Should()
            .BeSameAs(target);
            target.Factories.Count.Should()
            .Be(1);
            // ReSharper disable once PossibleNullReferenceException
            // ReSharper disable once AssignNullToNotNullAttribute
            var actualFactoryResult = (target.Factories.First() as ExpressionInstanceFactory).CreateValue(null);

            actualFactoryResult.Should()
            .Be("test");
        }
        public void NotForPredicateTest()
        {
            var target = new CreateInstanceOptions <String>();

            target.WithFactory(x => true);
            var actual = target.NotFor(x => true);

            actual.Should()
            .BeSameAs(target);

            var factory = target.Factories.First();

            factory.SelectionRules.Count.Should()
            .Be(1);
            var rule = factory.SelectionRules.First() as ExpressionMemberSelectionRule;

            rule.Should()
            .NotBeNull();
        }
 public void WithFactoryTest()
 {
     var target = new CreateInstanceOptions<String>();
     Func<IMemberInformation, Object> factory = x => "test";
     var actual = target.WithFactory( factory );
     actual.Should()
           .BeSameAs( target );
     target.Factories.Count.Should()
           .Be( 1 );
     var actualFactoryResult = ( target.Factories.First() as ExpressionInstanceFactory ).CreateValue( null );
     actualFactoryResult.Should()
                        .Be( "test" );
 }
 public void WithFactoryArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     Func<IMemberInformation, Object> factory = null;
     Action test = () => target.WithFactory( factory );
     test.ShouldThrow<ArgumentNullException>();
 }
        public void NotForPredicateTest()
        {
            var target = new CreateInstanceOptions<String>();
            target.WithFactory( x => true );
            var actual = target.NotFor( x => true );

            actual.Should()
                  .BeSameAs( target );

            var factory = target.Factories.First();
            factory.SelectionRules.Count.Should()
                   .Be( 1 );
            var rule = factory.SelectionRules.First() as ExpressionMemberSelectionRule;
            rule.Should()
                .NotBeNull();
        }
 public void NotForPredicateArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     target.WithFactory( x => "test" );
     Func<IMemberInformation, Boolean> predicate = null;
     Action test = () => target.NotFor( predicate );
     test.ShouldThrow<ArgumentNullException>();
 }
        public void NotForFuncTest()
        {
            var funcCalled = false;
            var target = new CreateInstanceOptions<String>();
            target.WithFactory( x => "test" );
            var actual = target.NotFor( x =>
            {
                funcCalled = true;
                return x.AllMembers();
            } );

            funcCalled.Should()
                      .BeTrue();

            actual.Should()
                  .BeSameAs( target );

            var factory = target.Factories.First();
            factory.SelectionRules.Count.Should()
                   .Be( 1 );
            var rule = factory.SelectionRules.First() as AllMemberSelectionRule;
            rule.Should()
                .NotBeNull();
        }
 public void NotForFuncArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     target.WithFactory( x => "test" );
     Func<IIncludeExcludeOptions<String>, IIncludeExcludeOptions<String>> configurationFunc = null;
     Action test = () => target.NotFor( configurationFunc );
     test.ShouldThrow<ArgumentNullException>();
 }