Skip to content

Instantly share code, notes, and snippets.

@bsommardahl
Created May 15, 2012 13:28
Show Gist options
  • Save bsommardahl/2701783 to your computer and use it in GitHub Desktop.
Save bsommardahl/2701783 to your computer and use it in GitHub Desktop.
EndOfHeatTimeCalculator
public class EndOfHeatTimeCalculator : IEndOfHeatTimeCalculator
{
readonly ILastTappedHeatFetcher _lastTappedHeatFetcher;
public EndOfHeatTimeCalculator(ILastTappedHeatFetcher lastTappedHeatFetcher)
{
_lastTappedHeatFetcher = lastTappedHeatFetcher;
}
#region IEndOfHeatTimeCalculator Members
public DateTime Calculate(DateTime startingFrom)
{
TappedHeat lastTappedHeat = _lastTappedHeatFetcher.Fetch();
TimeSpan timeToCompleteLastTappedHeat = lastTappedHeat.EndDate - lastTappedHeat.StartDate;
DateTime predictedEndOfHeat = startingFrom.Add(timeToCompleteLastTappedHeat);
return predictedEndOfHeat;
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment