mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 23:26:31 +01:00
24 lines
702 B
C#
24 lines
702 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TestTINKLib
|
|
{
|
|
public class DateTimeMocker
|
|
{
|
|
private static int m_iIndex;
|
|
private static IList<DateTime> m_oDateTimeSeries;
|
|
|
|
public DateTimeMocker(IList<DateTime> p_oDateTimeSeries)
|
|
{
|
|
if (p_oDateTimeSeries.Count < 1)
|
|
{
|
|
throw new Exception("Can not initialize mock object. List must contain at least one date time.");
|
|
}
|
|
|
|
m_iIndex = 0;
|
|
m_oDateTimeSeries = p_oDateTimeSeries;
|
|
}
|
|
|
|
public Func<DateTime> GetDateTime = () => m_oDateTimeSeries[m_iIndex < m_oDateTimeSeries.Count ? m_iIndex++ : m_iIndex = 0];
|
|
}
|
|
}
|