public async Task HourSummaryCreateTest_IntervalCount() { // Arrange ISummaryFactory summaryFactory = new HourSummaryFactory(); // Act Summary summary = await summaryFactory.CreateAsync(db); // Assert int expectedValue = 4; int actualValue = summary.SummaryIntervalList.Count(); Assert.IsTrue(actualValue == expectedValue, "Total number of intervals is wrong"); }
public async Task HourSummaryCreateTest_IntervalInternalCount() { // Arrange ISummaryFactory summaryFactory = new HourSummaryFactory(); // Act Summary summary = await summaryFactory.CreateAsync(db); // Assert int expectedValue = 1; int actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute)) .IntervalData .Count(); Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData, current minute"); expectedValue = 1; actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute - 1)) .IntervalData .Count(); Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData, current minute -1"); expectedValue = 1; actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute - 2)) .IntervalData .Count(); Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData, current minute -2"); expectedValue = 2; actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute - 3)) .IntervalData .Count(); Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData, current minute -3"); expectedValue = 1; actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute - 3)) .IntervalData .First(y => y.StatusName == "Sent") .StatusCount; Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData - Status: Sent, current minute -3"); expectedValue = 2; actualValue = summary.SummaryIntervalList .First(x => x.IntervalStart == DateTime.Now.Date.AddHours(DateTime.Now.Hour) .AddMinutes(DateTime.Now.Minute - 3)) .IntervalData .First(y => y.StatusName == "Error") .StatusCount; Assert.IsTrue(actualValue == expectedValue, "Count of IntervalData - Status: Error, current minute -3"); }