示例#1
0
        public void Create_MissingElapsed_ReturnsValidInstance()
        {
            var stats = CopyStats.Create(_summary, null);

            Assert.Equal(0, stats.ElapsedMilliseconds);
            Assert.Equal(0, stats.BytesPerSecond);
        }
示例#2
0
        public void Create_AllOk_ReturnsValidInstance()
        {
            var stopwatch = Stopwatch.StartNew();

            stopwatch.Stop();

            var stats = CopyStats.Create(_summary, stopwatch.Elapsed);

            Assert.Equal(stopwatch.ElapsedMilliseconds, stats.ElapsedMilliseconds);
            Assert.Equal((long)(stats.TotalBytesCopied / stopwatch.Elapsed.TotalSeconds), stats.BytesPerSecond);
        }
示例#3
0
        public void Create_SummaryMissing_ThrowsException()
        {
            var error = Assert.Throws <ArgumentNullException>(() => CopyStats.Create(null, null));

            Assert.Equal("summary", error.ParamName);
        }