当前位置: 首页>>代码示例>>C#>>正文


C# Int32.Months方法代码示例

本文整理汇总了C#中System.Int32.Months方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.Months方法的具体用法?C# Int32.Months怎么用?C# Int32.Months使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Int32的用法示例。


在下文中一共展示了Int32.Months方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: it_should_subtract_months_from_a_date

        public void it_should_subtract_months_from_a_date(Int32 arg)
        {
            DateTime kentuckyDerby = new DateTime(2011, 5, 7);
            DateTime actual = arg.Months().AgoFrom(kentuckyDerby);

            Assert.That(actual, Is.EqualTo(kentuckyDerby.AddMonths(-arg)));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:7,代码来源:DateTimeDsl.cs

示例2: 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));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:21,代码来源:DateTimeDsl.cs

示例3: it_should_add_months_to_a_date

        public void it_should_add_months_to_a_date(Int32 arg)
        {
            DateTime kentuckyDerby	= new DateTime(2011, 5, 7);
            DateTime actual			= arg.Months().From(kentuckyDerby);

            Assert.That(actual, Is.EqualTo(kentuckyDerby.AddMonths(arg)));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:7,代码来源:DateTimeDsl.cs

示例4: it_should_subtract_months_from_now

        public void it_should_subtract_months_from_now(Int32 arg)
        {
            DateTime actual		= arg.Months().Ago();
            DateTime expected	= _nowAdapter.DateTimeNow().AddMonths(-arg);

            Assert.That(actual, Is.EqualTo(expected));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:7,代码来源:DateTimeDsl.cs

示例5: 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));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:19,代码来源:DateTimeDsl.cs

示例6: it_should_add_months_to_now

        public void it_should_add_months_to_now(Int32 arg)
        {
            DateTime actual		= arg.Months().FromNow();
            DateTime expected	= _nowAdapter.DateTimeNow().AddMonths(arg);

            Assert.That(actual, Is.EqualTo(expected));
        }
开发者ID:kbeckman,项目名称:C4SC,代码行数:7,代码来源:DateTimeDsl.cs


注:本文中的System.Int32.Months方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。