本文整理汇总了C#中System.DateTime.addTimeUnits方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.addTimeUnits方法的具体用法?C# DateTime.addTimeUnits怎么用?C# DateTime.addTimeUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.DateTime
的用法示例。
在下文中一共展示了DateTime.addTimeUnits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addTimeUnits_D1_if_baseDate_is_Thursday_31December_and_one_day_is_to_be_subtracted
public void addTimeUnits_D1_if_baseDate_is_Thursday_31December_and_one_day_is_to_be_subtracted()
{
DateTime d = new DateTime(2015, 12, 31);
DateTime expected = new DateTime(2016, 1, 4);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 1);
Assert.AreEqual(expected, result);
}
示例2: addTimeUnits_D1_if_baseDate_is_Friday_29December_and_one_day_is_to_be_added
public void addTimeUnits_D1_if_baseDate_is_Friday_29December_and_one_day_is_to_be_added()
{
DateTime d = new DateTime(2017, 12, 29);
DateTime expected = new DateTime(2018, 1, 2);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 1);
Assert.AreEqual(expected, result);
}
示例3: addTimeUnits_D1_if_baseDate_is_Thursday_21December_and_two_days_are_to_be_added
public void addTimeUnits_D1_if_baseDate_is_Thursday_21December_and_two_days_are_to_be_added()
{
DateTime d = new DateTime(2017, 12, 21);
DateTime expected = new DateTime(2017, 12, 26);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 2);
Assert.AreEqual(expected, result);
}
示例4: addTimeUnits_H4_if_units_zero_the_same_date_is_returned
public void addTimeUnits_H4_if_units_zero_the_same_date_is_returned()
{
DateTime d = new DateTime(2016, 4, 21, 12, 0, 0);
DateTime expected = new DateTime(2016, 4, 21, 12, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.H4, 0);
Assert.AreEqual(expected, result);
}
示例5: addTimeUnits_H4_if_units_positive_with_week_break
public void addTimeUnits_H4_if_units_positive_with_week_break()
{
DateTime d = new DateTime(2016, 8, 2, 8, 0, 0);
DateTime expected = new DateTime(2016, 8, 12, 12, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.H4, 49);
Assert.AreEqual(expected, result);
}
示例6: addTimeUnits_D1_if_units_positive_with_few_new_year_breaks
public void addTimeUnits_D1_if_units_positive_with_few_new_year_breaks()
{
DateTime d = new DateTime(2012, 1, 25);
DateTime expected = new DateTime(2017, 8, 29);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 1451);
Assert.AreEqual(expected, result);
}
示例7: addTimeUnits_D1_if_baseDate_is_Tuesday_2January_and_one_day_is_to_be_subtracted
public void addTimeUnits_D1_if_baseDate_is_Tuesday_2January_and_one_day_is_to_be_subtracted()
{
DateTime d = new DateTime(2018, 1, 2);
DateTime expected = new DateTime(2017, 12, 29);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, -1);
Assert.AreEqual(expected, result);
}
示例8: addTimeUnits_M15_if_units_positive_omit_newYear_after_skip_weekend
public void addTimeUnits_M15_if_units_positive_omit_newYear_after_skip_weekend()
{
DateTime d = new DateTime(2017, 12, 29, 20, 0, 0);
DateTime expected = new DateTime(2018, 1, 2, 4, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.M15, 32);
Assert.AreEqual(expected, result);
}
示例9: addTimeUnits_M15_if_units_negative_with_week_break
public void addTimeUnits_M15_if_units_negative_with_week_break()
{
DateTime d = new DateTime(2016, 7, 26, 4, 0, 0);
DateTime expected = new DateTime(2016, 7, 15, 4, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.M15, -672);
Assert.AreEqual(expected, result);
}
示例10: addTimeUnits_M15_if_units_negative_with_newYear_at_week
public void addTimeUnits_M15_if_units_negative_with_newYear_at_week()
{
DateTime d = new DateTime(2015, 1, 6, 12, 0, 0);
DateTime expected = new DateTime(2014, 12, 30, 4, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.M15, -405);
Assert.AreEqual(expected, result);
}
示例11: addTimeUnits_H4_if_units_negative_with_christmas_and_newYear
public void addTimeUnits_H4_if_units_negative_with_christmas_and_newYear()
{
DateTime d = new DateTime(2015, 1, 7, 12, 0, 0);
DateTime expected = new DateTime(2013, 12, 23, 12, 0, 0);
DateTime result = d.addTimeUnits(TimeframeSymbol.H4, -1608);
Assert.AreEqual(expected, result);
}
示例12: addTimeUnits_D1_if_units_positive_with_week_break
public void addTimeUnits_D1_if_units_positive_with_week_break()
{
DateTime d = new DateTime(2016, 1, 21);
DateTime expected = new DateTime(2016, 8, 29);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 157);
Assert.AreEqual(expected, result);
}
示例13: if_units_zero_the_same_date_is_returned_for_d1
public void if_units_zero_the_same_date_is_returned_for_d1()
{
DateTime d = new DateTime(2016, 4, 21);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 0);
Assert.AreEqual(d, result);
}
示例14: addTimeUnits_D1_if_units_positive_with_weekendChristmas
public void addTimeUnits_D1_if_units_positive_with_weekendChristmas()
{
DateTime d = new DateTime(2016, 12, 22);
DateTime expected = new DateTime(2016, 12, 30);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 6);
Assert.AreEqual(expected, result);
}
示例15: addTimeUnits_D1_if_units_positive_with_new_year_break_at_weekend
public void addTimeUnits_D1_if_units_positive_with_new_year_break_at_weekend()
{
DateTime d = new DateTime(2016, 12, 28);
DateTime expected = new DateTime(2017, 1, 3);
DateTime result = d.addTimeUnits(TimeframeSymbol.D1, 4);
Assert.AreEqual(expected, result);
}