예제 #1
0
        public void ShouldRateEarlyBird_WhenEarlyBirdTimesMatch(string entryTimeStr, string exitTimeStr)
        {
            // Arrange
            var entryTime = DateTime.Parse(entryTimeStr);
            var exitTime  = DateTime.Parse(exitTimeStr);

            // Act
            var rateResult = _rateCalculator.GetRate(entryTime, exitTime);

            // Assert
            Assert.AreEqual(13.0m, rateResult.Rate);
            Assert.AreEqual(RateType.EarlyBird, rateResult.RateType);
        }
예제 #2
0
        private void SetTimeRemainingString()
        {
            Int64    rate = _calculator.GetRate();
            TimeSpan time = _calculator.GetTimeRemaining();

            String timeS = time == TimeSpan.MaxValue ? "Indeterminate" : time.ToString() + " remaining";

            __time.Text = String.Format(CultureInfo.InvariantCulture, "{0}% - {1} - {2}KB/{3}KB at {4}KB/s", __progress.Value, timeS, _calculator.LastValue / 1024, _calculator.Total / 1024, rate / 1024);
        }
예제 #3
0
        private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            _rate.Add(e.BytesReceived);

            Int64 xferRate = _rate.GetRate();

            String message = InstallerResources.GetString("C_C_downloadProgress");

            message = String.Format(Cult.CurrentCulture, message, e.ProgressPercentage, e.BytesReceived / 1024, e.TotalBytesToReceive / 1024, xferRate);

            BeginInvoke(new MethodInvoker(delegate() {
                __progress.Value = e.ProgressPercentage;
                __statusLbl.Text = message;
            }));
        }