示例#1
0
        public void GetSystemSystemStatisticsGetSystemBuildStatisticsHappyPath_Test()
        {
            //set up ------------------------------------------------------
            var dbContext = this.GetDbContext();
            var now       = DateTime.Now;
            var systemStatisticsToSave = new SystemStatistics
            {
                WebsiteIsUp       = true,
                DatabaseIsUp      = true,
                AzureFunctionIsUp = true,
                Created           = now
            };

            dbContext.SystemStatistics.Add(systemStatisticsToSave);
            dbContext.SaveChanges();

            //test ---------------------------------------------------------
            IBucketListData bd = new BucketListData(dbContext, this.userHelper);
            var             systemStatistics = bd.GetSystemStatistics();

            Assert.IsNotNull(systemStatistics);
            var systemStatistic = systemStatistics
                                  .OrderByDescending(x => Convert.ToDateTime(x.Created))
                                  .FirstOrDefault();

            Assert.AreEqual(systemStatistic.WebSiteIsUp, systemStatisticsToSave.WebsiteIsUp);
            Assert.AreEqual(systemStatistic.DatabaseIsUp, systemStatisticsToSave.DatabaseIsUp);
            Assert.AreEqual(systemStatistic.AzureFunctionIsUp, systemStatisticsToSave.AzureFunctionIsUp);
            Assert.AreEqual(systemStatistic.Created, systemStatisticsToSave.Created.ToString());

            //clean up ------------------------------------------------------
            dbContext.Remove(systemStatisticsToSave);
            dbContext.SaveChanges();
        }