Exemplo n.º 1
0
        /// <summary>
        /// Decorates the supplied builder with a <see cref="DisposableTracker"/>.
        /// </summary>
        /// <param name="builder">The builder to transform.</param>
        /// <returns>
        /// A new <see cref="DisposableTracker"/> that decorates <paramref name="builder"/>.
        /// </returns>
        /// <remarks>
        /// <para>
        /// The returned <see cref="DisposableTracker"/> is also added to the
        /// <see cref="Trackers"/> property.
        /// </para>
        /// </remarks>
        public ISpecimenBuilderNode Transform(ISpecimenBuilder builder)
        {
            var tracker = new DisposableTracker(builder);

            this.trackers.Add(tracker);
            return(tracker);
        }
Exemplo n.º 2
0
        /// <summary>Composes the supplied builders.</summary>
        /// <param name="builders">The builders to compose.</param>
        /// <returns>
        /// A new <see cref="ISpecimenBuilderNode" /> instance containing
        /// <paramref name="builders" /> as child nodes.
        /// </returns>
        public virtual ISpecimenBuilderNode Compose(IEnumerable <ISpecimenBuilder> builders)
        {
            var composedBuilder = CompositeSpecimenBuilder.ComposeIfMultiple(builders);
            var d = new DisposableTracker(composedBuilder);

            this.disposables.Add(d);
            return(d);
        }
Exemplo n.º 3
0
 public override void OneTimeSetup()
 {
     _disposableTrackerInstanceType    = typeof(DisposableTracker);
     _disposableTrackerInstanceFixture = this.Create <DisposableTracker>(true);
     _disposableTrackerInstance        = _disposableTrackerInstanceFixture ?? this.Create <DisposableTracker>(false);
     CurrentInstance = _disposableTrackerInstanceFixture;
     ConfigureIgnoringTests(); // Configure ignoring tests.
 }
Exemplo n.º 4
0
        /// <summary>Composes the supplied builders.</summary>
        /// <param name="builders">The builders to compose.</param>
        /// <returns>
        /// A new <see cref="ISpecimenBuilderNode" /> instance containing
        /// <paramref name="builders" /> as child nodes.
        /// </returns>
        public virtual ISpecimenBuilderNode Compose(IEnumerable <ISpecimenBuilder> builders)
        {
            if (builders == null)
            {
                throw new ArgumentNullException(nameof(builders));
            }

            var composedBuilder = CompositeSpecimenBuilder.ComposeIfMultiple(builders);
            var d = new DisposableTracker(composedBuilder);

            this.disposables.Add(d);
            return(d);
        }
Exemplo n.º 5
0
        public void AUT_DisposableTracker_Constructor_Instantiation_With_Parameter_Test()
        {
            // Arrange
            var builder = this.CreateType <ISpecimenBuilder>();
            DisposableTracker instance          = null;
            Exception         creationException = null;

            // Act
            Action createAction = () => instance = new DisposableTracker(builder);

            creationException = ActionAnalyzer.GetActionException(createAction);

            // Assert
            instance.ShouldNotBeNull();
            _disposableTrackerInstance.ShouldNotBeNull();
            _disposableTrackerInstanceFixture.ShouldNotBeNull();
            Should.NotThrow(createAction);
        }