예제 #1
0
        /// <summary>
        ///     Convert raw progress data to a percentage.
        /// </summary>
        /// <param name="rawProgress">
        ///     The sequence of raw progress data.
        /// </param>
        /// <param name="minimumChange">
        ///     The minimum change in percentage to report.
        /// </param>
        /// <returns>
        ///     An observable <see cref="ProgressStrategy{TValue}"/>.
        /// </returns>
        public static ProgressStrategy <long> Percentage(this IObservable <RawProgressData <long> > rawProgress, int minimumChange)
        {
            if (rawProgress == null)
            {
                throw new ArgumentNullException(nameof(rawProgress));
            }

            Int64ChunkedPercentageStrategy strategy = new Int64ChunkedPercentageStrategy(minimumChange);

            rawProgress.Subscribe(strategy);

            return(strategy);
        }
예제 #2
0
        public void Ctor_ChunkSize_5()
        {
            Int64ChunkedPercentageStrategy strategy = new Int64ChunkedPercentageStrategy(chunkSize: 5);

            Assert.Equal(5, strategy.ChunkSize);
        }