Esempio n. 1
0
        public async Task ReadUsageDataWorks()
        {
            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>(), environment);
            var usageData    = await usageService.ReadLocalData();

            Assert.AreEqual(usageData.LastUpdated.Date, DateTime.Parse("2017-02-24"));
        }
Esempio n. 2
0
        public async Task ReadUsageDataWorksWhenFileMissing()
        {
            File.Delete(usageFileName);

            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>(), environment);
            var usageData    = await usageService.ReadLocalData();

            Assert.AreEqual(usageData.LastUpdated.Date, DateTimeOffset.Now.Date);
        }
Esempio n. 3
0
        public async Task ReadUsageDataWorksWhenFileMissing()
        {
            File.Delete(usageFileName);

            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>(), environment, new JoinableTaskContext());
            var usageData    = await usageService.ReadLocalData();

            Assert.IsNotNull(usageData);
            Assert.IsNotNull(usageData.Reports);
            Assert.AreEqual(0, usageData.Reports.Count);
        }
Esempio n. 4
0
        public async Task ReadUsageDataWorks()
        {
            var usageService = new UsageService(Substitute.For <IGitHubServiceProvider>(), environment, new JoinableTaskContext());
            var usageData    = await usageService.ReadLocalData();

            Assert.IsNotNull(usageData);
            Assert.IsNotNull(usageData.Reports);
            Assert.AreEqual(1, usageData.Reports.Count);
            Assert.AreEqual(1, usageData.Reports[0].Measures.NumberOfClones);
            Assert.AreEqual(2, usageData.Reports[0].Measures.NumberOfReposPublished);
            Assert.AreEqual(3, usageData.Reports[0].Measures.NumberOfPullRequestsOpened);
        }