Пример #1
0
        public void it_should_subtract_seconds_from_a_timestamp(Int32 arg)
        {
            DateTime mileRelayStart = new DateTime(2000, 4, 10, 15, 0, 0);
            DateTime actual = arg.Seconds().AgoFrom(mileRelayStart);

            Assert.That(actual, Is.EqualTo(mileRelayStart.AddSeconds(-arg)));
        }
Пример #2
0
        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));
        }
Пример #3
0
        public void it_should_add_milliseconds_to_a_timestamp(Int32 arg)
        {
            DateTime executionTime	= new DateTime(2011, 06, 30, 0, 0, 0);
            DateTime actual			= arg.Seconds().From(executionTime);

            Assert.That(actual, Is.EqualTo(executionTime.AddSeconds(arg)));
        }
Пример #4
0
        public void it_should_subtract_seconds_from_now(Int32 arg)
        {
            DateTime actual		= arg.Seconds().Ago();
            DateTime expected	= _nowAdapter.DateTimeNow().AddSeconds(-arg);

            Assert.That(actual, Is.EqualTo(expected));
        }
Пример #5
0
        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));
        }
Пример #6
0
        public void it_should_add_seconds_to_now(Int32 arg)
        {
            DateTime actual		= arg.Seconds().FromNow();
            DateTime expected	= _nowAdapter.DateTimeNow().AddSeconds(arg);

            Assert.That(actual, Is.EqualTo(expected));
        }