本文整理汇总了C#中System.DateTime.countTimeUnits方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.countTimeUnits方法的具体用法?C# DateTime.countTimeUnits怎么用?C# DateTime.countTimeUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.DateTime
的用法示例。
在下文中一共展示了DateTime.countTimeUnits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: countTimeUnits_m30_returns_proper_value_for_date_few_days_later_after_weekend
public void countTimeUnits_m30_returns_proper_value_for_date_few_days_later_after_weekend()
{
DateTime d1 = new DateTime(2016, 8, 12, 12, 0, 0);
DateTime d2 = new DateTime(2016, 8, 16, 20, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M30);
Assert.AreEqual(112, result);
}
示例2: countTimeUnits_weeks_if_comparedDate_from_previous_years_proper_value_is_returned
public void countTimeUnits_weeks_if_comparedDate_from_previous_years_proper_value_is_returned()
{
DateTime d1 = new DateTime(2016, 4, 21);
DateTime d2 = new DateTime(2015, 12, 5);
int result = d1.countTimeUnits(d2, TimeframeSymbol.W1);
Assert.AreEqual(-20, result);
}
示例3: countTimeUnits_weeks_if_second_date_not_first_date_of_week_rounded_value_is_used
public void countTimeUnits_weeks_if_second_date_not_first_date_of_week_rounded_value_is_used()
{
DateTime d1 = new DateTime(2016, 8, 1);
DateTime d2 = new DateTime(2016, 8, 11);
int result = d1.countTimeUnits(d2, TimeframeSymbol.W1);
Assert.AreEqual(1, result);
}
示例4: countTimeUnits_months_if_earlier_date_proper_value_is_returned
public void countTimeUnits_months_if_earlier_date_proper_value_is_returned()
{
DateTime d1 = new DateTime(2016, 4, 1);
DateTime d2 = new DateTime(2016, 4, 21);
int result = d1.countTimeUnits(d2, TimeframeSymbol.MN1);
Assert.AreEqual(0, result);
}
示例5: countTimeUnits_months_if_second_date_not_first_date_of_month_rounded_value_is_used
public void countTimeUnits_months_if_second_date_not_first_date_of_month_rounded_value_is_used()
{
DateTime d1 = new DateTime(2016, 4, 1);
DateTime d2 = new DateTime(2016, 11, 16);
int result = d1.countTimeUnits(d2, TimeframeSymbol.MN1);
Assert.AreEqual(7, result);
}
示例6: countTimeUnits_m5_returns_proper_value_for_date_few_weekends_later
public void countTimeUnits_m5_returns_proper_value_for_date_few_weekends_later()
{
DateTime d1 = new DateTime(2016, 8, 10, 16, 0, 0);
DateTime d2 = new DateTime(2016, 8, 22, 12, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M5);
Assert.AreEqual(2256, result);
}
示例7: countTimeUnits_months_if_both_dates_from_the_same_month_but_base_date_is_earlier_zero_is_returned
public void countTimeUnits_months_if_both_dates_from_the_same_month_but_base_date_is_earlier_zero_is_returned()
{
DateTime d1 = new DateTime(2016, 4, 15);
DateTime d2 = new DateTime(2016, 4, 30);
int result = d1.countTimeUnits(d2, TimeframeSymbol.MN1);
Assert.AreEqual(0, result);
}
示例8: countTimeUnits_m5_returns_proper_value_for_date_few_days_earlier_before_weekend
public void countTimeUnits_m5_returns_proper_value_for_date_few_days_earlier_before_weekend()
{
DateTime d1 = new DateTime(2016, 8, 17, 12, 0, 0);
DateTime d2 = new DateTime(2016, 8, 11, 12, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M5);
Assert.AreEqual(-1152, result);
}
示例9: countTimeUnits_m5_returns_proper_value_for_date_few_days_earlier_before_weekend_and_before_christmas
public void countTimeUnits_m5_returns_proper_value_for_date_few_days_earlier_before_weekend_and_before_christmas()
{
DateTime d1 = new DateTime(2015, 12, 29, 12, 0, 0);
DateTime d2 = new DateTime(2015, 12, 24, 12, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M5);
Assert.AreEqual(-541, result);
}
示例10: DateTime
public void countTimeUnits_m30_returns_proper_value_for_date_two_weeks_earlier_with_dayOfWeek_earlier_than_base_date()
{
DateTime d1 = new DateTime(2016, 8, 19, 12, 0, 0);
DateTime d2 = new DateTime(2016, 8, 3, 16, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M30);
Assert.AreEqual(-568, result);
}
示例11: countTimeUnits_m5_if_date_in_the_same_range_is_given_zero_is_returned
public void countTimeUnits_m5_if_date_in_the_same_range_is_given_zero_is_returned()
{
DateTime d1 = new DateTime(2016, 8, 11, 12, 0, 0);
DateTime d2 = new DateTime(2016, 8, 11, 12, 1, 53);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M5);
Assert.AreEqual(0, result);
}
示例12: countTimeUnits_m30_returns_proper_value_for_date_few_weekends_earlier
public void countTimeUnits_m30_returns_proper_value_for_date_few_weekends_earlier()
{
DateTime d1 = new DateTime(2016, 8, 11, 12, 0, 0);
DateTime d2 = new DateTime(2016, 7, 21, 16, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M30);
Assert.AreEqual(-712, result);
}
示例13: countTimeUnits_m30_returns_proper_value_for_date_few_days_later_in_the_same_week_after_christmas
public void countTimeUnits_m30_returns_proper_value_for_date_few_days_later_in_the_same_week_after_christmas()
{
DateTime d1 = new DateTime(2014, 12, 23, 12, 0, 0);
DateTime d2 = new DateTime(2014, 12, 26, 16, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M30);
Assert.AreEqual(99, result);
}
示例14: countTimeUnits_m30_returns_proper_value_for_date_few_days_later_after_weekend_and_after_newYear
public void countTimeUnits_m30_returns_proper_value_for_date_few_days_later_after_weekend_and_after_newYear()
{
DateTime d1 = new DateTime(2014, 12, 30, 16, 0, 0);
DateTime d2 = new DateTime(2015, 1, 6, 12, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M30);
Assert.AreEqual(179, result);
}
示例15: countTimeUnits_m5_returns_proper_value_for_date_few_newYears_earlier
public void countTimeUnits_m5_returns_proper_value_for_date_few_newYears_earlier()
{
DateTime d1 = new DateTime(2016, 12, 26, 16, 0, 0);
DateTime d2 = new DateTime(2012, 10, 23, 16, 0, 0);
int result = d1.countTimeUnits(d2, TimeframeSymbol.M5);
Assert.AreEqual(-311048, result);
}