public void ItShouldFormatUnspecifiedTimeAsLocal()
        {
            DateTime?dateTime = new DateTime(2000, 3, 5, 7, 11, 13, DateTimeKind.Unspecified);

            var clock = new CustomSystemClock(timeZoneId: "W. Europe Standard Time");

            string formatted = dateTime.ToLocalTimeFormatted(clock);

            Assert.Equal("2000-03-05 08:11:13", formatted);
        }
Beispiel #2
0
        public async Task ScheduleEverySecondWithRealTimer(int milliseconds, int interval, int expected)
        {
            var clock    = new CustomSystemClock();
            var start    = clock.UtcNow().AddMilliseconds(100);
            var schedule = new ScheduleEveryInterval(TimeSpan.FromMilliseconds(interval), start);

            using var timer     = new SystemTimer();
            using var scheduler = new Scheduler(clock, timer, Logger.None);
            var testService = new TestScheduledService(schedule, scheduler);

            await Task.Delay(TimeSpan.FromMilliseconds(milliseconds));

            testService.Invokations.Should().Be(expected);
        }