コード例 #1
0
ファイル: MetricsTests.cs プロジェクト: zotovv/VisualStudio
        public void IsSameDayWorks()
        {
            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>(), environment);
            var now          = DateTimeOffset.Now;

            Assert.True(usageService.IsSameDay(now));
            Assert.True(usageService.IsSameDay(now));
            Assert.False(usageService.IsSameDay(now.AddDays(1)));
            Assert.False(usageService.IsSameDay(now.AddDays(-1)));
        }
コード例 #2
0
ファイル: MetricsTests.cs プロジェクト: traanhn/VisualStudio
        public void IsSameDayWorks()
        {
            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>());
            var now          = DateTimeOffset.Now;

            Assert.True(usageService.IsSameDay(now));
            Assert.True(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day, 0, 0, 0, TimeSpan.Zero)));
            Assert.False(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day + 1, 0, 0, 0, TimeSpan.Zero)));
            Assert.False(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day - 1, 0, 0, 0, TimeSpan.Zero)));
            Assert.True(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day, 10, 3, 1, TimeSpan.Zero)));
            Assert.False(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day + 1, 10, 3, 1, TimeSpan.Zero)));
            Assert.False(usageService.IsSameDay(new DateTimeOffset(now.Year, now.Month, now.Day - 1, 10, 3, 1, TimeSpan.Zero)));
        }