Esempio n. 1
0
 /// <summary>
 /// Creates the appropriate initial graph for a
 /// <see cref="NodeComposer{T}" />.
 /// </summary>
 /// <typeparam name="T">The type of specimen to compose.</typeparam>
 /// <returns>
 /// A new <see cref="NodeComposer{T}" /> instance with an appropriate
 /// initial underlying graph.
 /// </returns>
 public static NodeComposer <T> CreateComposer <T>()
 {
     return(new NodeComposer <T>(
                SpecimenBuilderNodeFactory.CreateTypedNode(
                    typeof(T),
                    new MethodInvoker(
                        new ModestConstructorQuery()))));
 }
        public void AUT_SpecimenBuilderNodeFactory_CreateTypedNode_Static_Method_DirectCall_No_Exception_Thrown_Test()
        {
            // Arrange
            this.ValidateExecuteCondition(MethodCreateTypedNode);
            var targetType = this.CreateType <Type>();
            var factory    = this.CreateType <ISpecimenBuilder>();

            // Act
            Action executeAction = () => SpecimenBuilderNodeFactory.CreateTypedNode(targetType, factory);

            // Assert
            Should.NotThrow(executeAction);
        }
        public void AUT_SpecimenBuilderNodeFactory_CreateTypedNode_Static_Method_DirectCall_Result_ShouldNotBe_Null_Test()
        {
            // Arrange
            this.ValidateExecuteCondition(MethodCreateTypedNode);
            var targetType    = this.CreateType <Type>();
            var factory       = this.CreateType <ISpecimenBuilder>();
            var returnedValue = default(FilteringSpecimenBuilder);

            // Act
            Action executeAction = () => returnedValue = SpecimenBuilderNodeFactory.CreateTypedNode(targetType, factory);

            ActionAnalyzer.DoesActionThrowException(executeAction);

            // Assert
            returnedValue.ShouldNotBeNull();
        }