本文整理汇总了C#中Time.AddMinutes方法的典型用法代码示例。如果您正苦于以下问题:C# Time.AddMinutes方法的具体用法?C# Time.AddMinutes怎么用?C# Time.AddMinutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time.AddMinutes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_Add_Minutes
public void Can_Add_Minutes()
{
Time time = new Time(22, 30);
time = time.AddMinutes(105);
Assert.AreEqual(0, time.Hour);
Assert.AreEqual(15, time.Minute);
}
示例2: AddMinsTest
public void AddMinsTest()
{
int hour = 8;
int mins = 9;
int second = 1;
var target = new Time(hour, mins, second);
int min = 55;
target = target.AddMinutes(min);
var expect = new TimeSpan(hour, (min + mins), second);
Assert.AreEqual(expect.Ticks, target.Ticks);
}
示例3: GetSampleValue
private static object GetSampleValue(Type fieldType, bool allowNull, int n)
{
if (fieldType == typeof(string))
{
return "Sample Data " + n;
}
if (allowNull)
{
return GetSampleValue(fieldType.GetGenericArguments()[0], false, n);
}
if (fieldType == typeof(int))
{
return (int)(1 + n);
}
if (fieldType == typeof(short))
{
return (short)(1 + n);
}
if (fieldType == typeof(long))
{
return (long)(1 + n);
}
if (fieldType == typeof(float))
{
return (float)(0.1 + n);
}
if (fieldType == typeof(double))
{
return (double)(0.1 + n);
}
if (fieldType == typeof(bool))
{
return (n % 2) == 0;
}
if (fieldType == typeof(DateTime))
{
var dt = new DateTime(2008, 3, 6, 12, 24, 35);
return dt.AddDays(n);
}
if (fieldType == typeof(Date))
{
var d = new Date(2008, 3, 17);
return d.AddDays(n);
}
if (fieldType == typeof(Time))
{
var t = new Time(12, 24, 35);
return t.AddMinutes(n);
}
if (fieldType == typeof(Guid))
{
return Util.NewGuid();
}
if (fieldType == typeof(byte))
{
return (byte)n;
}
if (fieldType == typeof(sbyte))
{
return (sbyte)n;
}
if (fieldType == typeof(decimal))
{
return (decimal)n;
}
if (fieldType == typeof(byte[]))
{
return new byte[] { 61, 62, 63 };
}
if (fieldType.IsEnum)
{
string[] ss = Enum.GetNames(fieldType);
string name = ss[n % ss.Length];
return Enum.Parse(fieldType, name);
}
return null;
}
示例4: AddMinutes
public void AddMinutes()
{
Time t = new Time(2010, 2, 3);
Time t2 = t.AddMinutes(5);
(t2.NetTime - t.NetTime).TotalMinutes.Should().Be(5);
}