當前位置: 首頁>>代碼示例>>C#>>正文


C# Int32.Days方法代碼示例

本文整理匯總了C#中System.Int32.Days方法的典型用法代碼示例。如果您正苦於以下問題:C# Int32.Days方法的具體用法?C# Int32.Days怎麽用?C# Int32.Days使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Int32的用法示例。


在下文中一共展示了Int32.Days方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: it_should_subtract_days_from_a_date

        public void it_should_subtract_days_from_a_date(Int32 arg)
        {
            DateTime lastMonday = new DateTime(2011, 11, 14);
            DateTime actual = arg.Days().AgoFrom(lastMonday);

            Assert.That(actual, Is.EqualTo(lastMonday.AddDays(-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_days_to_a_date

        public void it_should_add_days_to_a_date(Int32 arg)
        {
            DateTime lastMonday = new DateTime(2011, 11, 14);
            DateTime actual		= arg.Days().From(lastMonday);

            Assert.That(actual, Is.EqualTo(lastMonday.AddDays(arg)));
        }
開發者ID:kbeckman,項目名稱:C4SC,代碼行數:7,代碼來源:DateTimeDsl.cs

示例4: it_should_subtract_days_from_now

        public void it_should_subtract_days_from_now(Int32 arg)
        {
            DateTime actual		= arg.Days().Ago();
            DateTime expected	= _nowAdapter.DateTimeNow().AddDays(-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_days_to_now

        public void it_should_add_days_to_now(Int32 arg)
        {
            DateTime actual		= arg.Days().FromNow();
            DateTime expected	= _nowAdapter.DateTimeNow().AddDays(arg);

            Assert.That(actual, Is.EqualTo(expected));
        }
開發者ID:kbeckman,項目名稱:C4SC,代碼行數:7,代碼來源:DateTimeDsl.cs


注:本文中的System.Int32.Days方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。