本文整理汇总了C#中System.Int32.Milliseconds方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.Milliseconds方法的具体用法?C# Int32.Milliseconds怎么用?C# Int32.Milliseconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Int32
的用法示例。
在下文中一共展示了Int32.Milliseconds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: it_should_subtract_all_components_from_a_timestamp
public void it_should_subtract_all_components_from_a_timestamp(Int32 years, Int32 months, Int32 weeks, Int32 days, Int32 minutes, Int32 seconds, Int32 milliseconds)
{
DateTime twentyTwelve = new DateTime(2012, 1, 1, 0, 0, 0, 0);
DateTime actual = years.Years()
.And(months.Months())
.And(weeks.Weeks())
.And(days.Days())
.And(minutes.Minutes())
.And(seconds.Seconds())
.And(milliseconds.Milliseconds()).AgoFrom(twentyTwelve);
DateTime expected = twentyTwelve.AddYears(-years)
.AddMonths(-months)
.AddDays(-days + -(weeks * 7))
.AddMinutes(-minutes)
.AddSeconds(-seconds)
.AddMilliseconds(-milliseconds);
Assert.That(actual, Is.EqualTo(expected));
}
示例2: it_should_stubract_milliseconds_from_a_timestamp
public void it_should_stubract_milliseconds_from_a_timestamp(Int32 arg)
{
DateTime executionTime = new DateTime(2011, 06, 30, 0, 0, 0);
DateTime actual = arg.Milliseconds().AgoFrom(executionTime);
Assert.That(actual, Is.EqualTo(executionTime.AddMilliseconds(-arg)));
}
示例3: it_should_subtract_all_components_from_now
public void it_should_subtract_all_components_from_now(Int32 years, Int32 months, Int32 weeks, Int32 days, Int32 minutes, Int32 seconds, Int32 milliseconds)
{
DateTime actual = years.Years()
.And(months.Months())
.And(weeks.Weeks())
.And(days.Days())
.And(minutes.Minutes())
.And(seconds.Seconds())
.And(milliseconds.Milliseconds()).Ago();
DateTime expected = _nowAdapter.DateTimeNow().AddYears(-years)
.AddMonths(-months)
.AddDays(-days + -(weeks * 7))
.AddMinutes(-minutes)
.AddSeconds(-seconds)
.AddMilliseconds(-milliseconds);
Assert.That(actual, Is.EqualTo(expected));
}
示例4: it_should_subtract_milliseconds_from_now
public void it_should_subtract_milliseconds_from_now(Int32 arg)
{
DateTime actual = arg.Milliseconds().Ago();
DateTime expected = _nowAdapter.DateTimeNow().AddMilliseconds(-arg);
Assert.That(actual, Is.EqualTo(expected));
}
示例5: it_should_add_milliseconds_to_now
public void it_should_add_milliseconds_to_now(Int32 arg)
{
DateTime actual = arg.Milliseconds().FromNow();
DateTime expected = _nowAdapter.DateTimeNow().AddMilliseconds(arg);
Assert.That(actual, Is.EqualTo(expected));
}