Exemplo n.º 1
0
        /// <summary>
        /// Builds the final task and returns it.
        /// </summary>
        /// <param name="taskName">Name for the new task.</param>
        /// <returns>A built and configured task.</returns>
        public ITask Build(string taskName)
        {
            var task = new SimpleDataflowTask <T, T>(taskName, this.source, this.mapEntity, this.target);

            var fileScope = new ResourceScope(taskName + " resource scope", task, this.resources);

            // Ensure that these resource are disposed of one way xor another.
            this.resources = new HashSet <IDisposable>();

            return(fileScope);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleDataflowTaskFacts"/> class.
        /// </summary>
        public SimpleDataflowTaskFacts()
        {
            this.fixture    = new Fixture();
            this.source     = this.fixture.CreateMany <FakeEntity>();
            this.repository = Substitute.For <IBulkRepository <FakeEntity> >();
            this.context    = Substitute.For <ITaskContext>();

            this.repository.BulkCopyAsync(
                Arg.Do <IEnumerable <FakeEntity> >(a => this.data = a),
                Arg.Any <ITaskContext>());

            this.dataflow = new SimpleDataflowTask <FakeEntity, FakeEntity>(
                this.source,
                MappingFunctions.Identity,
                this.repository);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleDataflowTaskFacts"/> class.
        /// </summary>
        public SimpleDataflowTaskFacts()
        {
            this.fixture = new Fixture();
            this.source = this.fixture.CreateMany<FakeEntity>();
            this.repository = Substitute.For<IBulkRepository<FakeEntity>>();
            this.context = Substitute.For<ITaskContext>();

            this.repository.BulkCopyAsync(
                Arg.Do<IEnumerable<FakeEntity>>(a => this.data = a),
                Arg.Any<ITaskContext>());
            
            this.dataflow = new SimpleDataflowTask<FakeEntity, FakeEntity>(
                this.source,
                MappingFunctions.Identity,
                this.repository);
        }