public void ForPredicateInvalidOperationExceptionTest()
        {
            var    target = new CreateInstanceOptions <String>();
            Action test   = () => target.For(x => true);

            Assert.Throws <InvalidOperationException>(test);
        }
        public void ForFuncInvalidOperationExceptionTest()
        {
            var    target = new CreateInstanceOptions <String>();
            Action test   = () => target.For(x => x.AllMembers());

            Assert.Throws <InvalidOperationException>(test);
        }
        public void NotForFuncInvalidOperationExceptionTest()
        {
            var    target = new CreateInstanceOptions <String>();
            Action test   = () => target.NotFor(x => x.AllMembers());

            test.ShouldThrow <InvalidOperationException>();
        }
        public void PopulateCollectionItemCountArgumentExceptionTest()
        {
            var    target = new CreateInstanceOptions <String>();
            Action test   = () => target.PopulateCollectionItemCount(400, 300);

            test.ShouldThrow <ArgumentException>();
        }
        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 NotForPredicateInvalidOperationExceptionTest()
        {
            var    target = new CreateInstanceOptions <String>();
            Action test   = () => target.NotFor(x => true);

            test.ShouldThrow <InvalidOperationException>();
        }
 public void ByPathStringArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     String expression = null;
     Action test = () => target.ByPath( expression );
     test.ShouldThrow<ArgumentNullException>();
 }
        public void CompleteTest()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.Complete();

            actual.Should()
            .BeSameAs(target);
        }
        public void CompleteTest()
        {
            var target = new CreateInstanceOptions<String>();
            var actual = target.Complete();

            actual.Should()
                  .BeSameAs( target );
        }
示例#10
0
        public void ByPathExpressionArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Expression <Func <String, Object> > expression = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.ByPath(expression);

            Assert.Throws <ArgumentNullException>(test);
        }
示例#11
0
        public void ExcludingChildrenOfPredicateArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IMemberInformation, Boolean> predicate = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.ExcludingChildrenOf(predicate);

            Assert.Throws <ArgumentNullException>(test);
        }
        public void IncludingFuncArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IIncludeExcludeOptions <String>, IIncludeExcludeOptions <String> > configurationFunc = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.Including(configurationFunc);

            test.ShouldThrow <ArgumentNullException>();
        }
示例#13
0
        public void ExcludingChildrenOfFuncArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IIncludeExcludeOptions <String>, IIncludeExcludeOptions <String> > configurationFunc = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.ExcludingChildrenOf(configurationFunc);

            Assert.Throws <ArgumentNullException>(test);
        }
        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 ByPathStringArgumentNullExceptionTest()
        {
            var    target     = new CreateInstanceOptions <String>();
            String expression = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.ByPath(expression);

            test.ShouldThrow <ArgumentNullException>();
        }
        public void IncludingPredicateArgumentNullExceptionTest()
        {
            var target = new CreateInstanceOptions <String>();
            Func <IMemberInformation, Boolean> predicate = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => target.Including(predicate);

            test.ShouldThrow <ArgumentNullException>();
        }
        public void PopulateCollectionMembersTest1()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.PopulateCollectionMembers(null);

            actual.Should()
            .BeSameAs(target);
            target.PopulateCollections.Should()
            .Be(null);
        }
        public void SetAnonymousItemNameTest1()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.SetAnonymousItemName("name");

            actual.Should()
            .BeSameAs(target);
            target.AnonymousItemName.Should()
            .Be("name");
        }
示例#19
0
        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);

            Assert.Throws <ArgumentNullException>(test);
        }
示例#20
0
        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);

            Assert.Throws <ArgumentNullException>(test);
        }
        public void PopulateCollectionItemCountTest2()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.PopulateCollectionItemCount(null, 200);

            actual.Should()
            .BeSameAs(target);
            target.PopulateCollectionsMinCount.Should()
            .Be(null);
            target.PopulateCollectionsMaxCount.Should()
            .Be(200);
        }
        public void ByPathStringTest()
        {
            var target = new CreateInstanceOptions<String>();
            var actual = target.ByPath( "test" );
            actual.Should()
                  .BeSameAs( target );

            target.MemberSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = target.MemberSelectionRules.First() as PathMemberSelectionRule;
            actualRule.Should()
                      .NotBeNull();
        }
        public void ByPathStringTest()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.ByPath("test");

            actual.Should()
            .BeSameAs(target);

            target.MemberSelectionRules.Count.Should()
            .Be(1);

            var actualRule = target.MemberSelectionRules.First() as PathMemberSelectionRule;

            actualRule.Should()
            .NotBeNull();
        }
        public void IncludingExpressionTest()
        {
            var target = new CreateInstanceOptions <String>();

            target.Including(x => true);

            var actual = target.Complete();

            actual.MemberSelectionRules.Count.Should()
            .Be(1);

            var actualRule = actual.MemberSelectionRules.First() as ExpressionMemberSelectionRule;

            actualRule.Should()
            .NotBeNull();
        }
        public void IsTypeOfTest()
        {
            var target = new CreateInstanceOptions <String>();
            var actual = target.IsTypeOf <String>();

            actual.Should()
            .BeSameAs(target);

            target.MemberSelectionRules.Count.Should()
            .Be(1);

            var actualRule = target.MemberSelectionRules.First() as TypeMemberSelectionRule;

            actualRule.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);
            // 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 IncludingChildrenOfPathExpressionTest()
        {
            var functionCalled = false;
            var target         = new CreateInstanceOptions <String>();

            target.IncludingChildrenOf(x =>
            {
                functionCalled = true;
                return(x.ByPath(y => y.Length));
            });

            functionCalled.Should()
            .BeTrue();

            var actual = target.Complete();

            actual.MemberChildrenSelectionRules.Count.Should()
            .Be(1);

            var actualRule = actual.MemberChildrenSelectionRules.First() as PathMemberSelectionRule;

            actualRule.Should()
            .NotBeNull();
        }
        public void IncludingPathStringTest()
        {
            var functionCalled = false;
            var target         = new CreateInstanceOptions <String>();

            target.Including(x =>
            {
                functionCalled = true;
                return(x.ByPath("Test"));
            });

            functionCalled.Should()
            .BeTrue();

            var actual = target.Complete();

            actual.MemberSelectionRules.Count.Should()
            .Be(1);

            var actualRule = actual.MemberSelectionRules.First() as PathMemberSelectionRule;

            actualRule.Should()
            .NotBeNull();
        }
        public void IncludingChildrenOfIsNotTypeOfTest()
        {
            var functionCalled = false;
            var target         = new CreateInstanceOptions <String>();

            target.IncludingChildrenOf(x =>
            {
                functionCalled = true;
                return(x.IsNotTypeOf <String>());
            });

            functionCalled.Should()
            .BeTrue();

            var actual = target.Complete();

            actual.MemberChildrenSelectionRules.Count.Should()
            .Be(1);

            var actualRule = actual.MemberChildrenSelectionRules.First() as TypeMemberSelectionRule;

            actualRule.Should()
            .NotBeNull();
        }
        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 PopulateCollectionItemCountArgumentExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     Action test = () => target.PopulateCollectionItemCount( 400, 300 );
     test.ShouldThrow<ArgumentException>();
 }
 public void PopulateCollectionItemCountTest2()
 {
     var target = new CreateInstanceOptions<String>();
     var actual = target.PopulateCollectionItemCount( null, 200 );
     actual.Should()
           .BeSameAs( target );
     target.PopulateCollectionsMinCount.Should()
           .Be( null );
     target.PopulateCollectionsMaxCount.Should()
           .Be( 200 );
 }
        public void ExcludingAllMembersTest()
        {
            var functionCalled = false;
            var target = new CreateInstanceOptions<String>();
            target.Excluding( x =>
            {
                functionCalled = true;
                return x.AllMembers();
            } );

            functionCalled.Should()
                          .BeTrue();

            var actual = target.Complete();
            actual.MemberSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = actual.MemberSelectionRules.First() as AllMemberSelectionRule;
            actualRule.Should()
                      .NotBeNull();
        }
        public void IncludingExpressionTest()
        {
            var target = new CreateInstanceOptions<String>();
            target.Including( x => true );

            var actual = target.Complete();
            actual.MemberSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = actual.MemberSelectionRules.First() as ExpressionMemberSelectionRule;
            actualRule.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 SetAnonymousItemNameTest1()
 {
     var target = new CreateInstanceOptions<String>();
     var actual = target.SetAnonymousItemName( "name" );
     actual.Should()
           .BeSameAs( target );
     target.AnonymousItemName.Should()
           .Be( "name" );
 }
 public void WithFactoryArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     Func<IMemberInformation, Object> factory = null;
     Action test = () => target.WithFactory( factory );
     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 );
     var actualFactoryResult = ( target.Factories.First() as ExpressionInstanceFactory ).CreateValue( null );
     actualFactoryResult.Should()
                        .Be( "test" );
 }
        public void IncludingChildrenOfPathStringTest()
        {
            var functionCalled = false;
            var target = new CreateInstanceOptions<String>();
            target.IncludingChildrenOf( x =>
            {
                functionCalled = true;
                return x.ByPath( "Test" );
            } );

            functionCalled.Should()
                          .BeTrue();

            var actual = target.Complete();
            actual.MemberChildrenSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = actual.MemberChildrenSelectionRules.First() as PathMemberSelectionRule;
            actualRule.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>();
 }
        public void NotForFuncInvalidOperationExceptionTest()
        {
            var target = new CreateInstanceOptions<String>();
            Action test = () => target.NotFor( x => x.AllMembers() );

            test.ShouldThrow<InvalidOperationException>();
        }
        public void NotForPredicateInvalidOperationExceptionTest()
        {
            var target = new CreateInstanceOptions<String>();
            Action test = () => target.NotFor( x => true );

            test.ShouldThrow<InvalidOperationException>();
        }
        public void IncludingPathExpressionTest()
        {
            var functionCalled = false;
            var target = new CreateInstanceOptions<String>();
            target.Including( x =>
            {
                functionCalled = true;
                return x.ByPath( y => y.Length );
            } );

            functionCalled.Should()
                          .BeTrue();

            var actual = target.Complete();
            actual.MemberSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = actual.MemberSelectionRules.First() as PathMemberSelectionRule;
            actualRule.Should()
                      .NotBeNull();
        }
 public void PopulateCollectionMembersTest1()
 {
     var target = new CreateInstanceOptions<String>();
     var actual = target.PopulateCollectionMembers( null );
     actual.Should()
           .BeSameAs( target );
     target.PopulateCollections.Should()
           .Be( null );
 }
 public void IncludingFuncArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     Func<IIncludeExcludeOptions<String>, IIncludeExcludeOptions<String>> configurationFunc = null;
     Action test = () => target.Including( configurationFunc );
     test.ShouldThrow<ArgumentNullException>();
 }
        public void IsTypeOfTest()
        {
            var target = new CreateInstanceOptions<String>();
            var actual = target.IsTypeOf<String>();
            actual.Should()
                  .BeSameAs( target );

            target.MemberSelectionRules.Count.Should()
                  .Be( 1 );

            var actualRule = target.MemberSelectionRules.First() as TypeMemberSelectionRule;
            actualRule.Should()
                      .NotBeNull();
        }
 public void IncludingPredicateArgumentNullExceptionTest()
 {
     var target = new CreateInstanceOptions<String>();
     Func<IMemberInformation, Boolean> predicate = null;
     Action test = () => target.Including( 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();
        }