コード例 #1
0
        public void Update_New_TwitterReportLikesPePeriod_With_Invalid_UserName()
        {
            //Arrange - create a report
            TwitterReportLikesByPeriod report = new TwitterReportLikesByPeriod();

            //Arrange - set incorrect name
            report.UserName = "******";

            //Act
            bool result = TweetsReportGenerator.UpdateReport(report);

            //Assert
            Assert.AreEqual(result, false);
        }
コード例 #2
0
        public void UpdateReport(TwitterReportLikesByPeriod report)
        {
            if (report == null)
            {
                return;
            }
            TwitterReportLikesByPeriod dbEntry = context.ReportLikesByPeriod.Find(report.ID);

            if (dbEntry == null)
            {
                return;
            }
            IEnumerable <TwitterReportPartLikesByHour> oldCollection = dbEntry.reportParts;

            TweetsReportGenerator.UpdateReport(dbEntry);
            if (oldCollection != null)
            {
                context.ReportPartLikesByHour.RemoveRange(oldCollection);
            }
            context.ReportPartLikesByHour.AddRange(dbEntry.reportParts);
            context.SaveChanges();
        }