public void CreateFromData_2TagsDiffStarts_3Intervals() { var h1 = new HistoryStub1() { _StartTS = DateTime.Today.AddDays(-10), _EndTS = DateTime.Today.AddDays(-3) }; var c1 = new CurrentStub1() { _StartTS = DateTime.Today.AddDays(-3) }; var c2 = new CurrentStub2() { _StartTS = DateTime.Today.AddDays(-7) }; var intervals = Interval.CreateFromData(h1, c1, c2); Assert.AreEqual(3, intervals.Length); Assert.AreEqual(h1.ToStartTS(), intervals[0].StartTS); Assert.AreEqual(c2.ToStartTS(), intervals[0].EndTS); Assert.AreEqual(1, intervals[0].Data.Count); Assert.AreEqual(c2.ToStartTS(), intervals[1].StartTS); Assert.AreEqual(c1.ToStartTS(), intervals[1].EndTS); Assert.AreEqual(2, intervals[1].Data.Count); Assert.AreEqual(c1.ToStartTS(), intervals[2].StartTS); Assert.Null(intervals[2].EndTS); Assert.AreEqual(2, intervals[2].Data.Count); }
public void CreateFromData_2Tags1and2Intervals_2Intervals() { var c1 = new CurrentStub1() { _StartTS = DateTime.Today }; var h1 = new HistoryStub1() { _StartTS = DateTime.Today.AddDays(-10), _EndTS = DateTime.Today.AddDays(-1) }; var c2 = new CurrentStub2() { _StartTS = DateTime.Today.AddDays(-10) }; var intervals = Interval.CreateFromData(c2, c1, h1); Assert.AreEqual(2, intervals.Length); Assert.AreEqual(h1._StartTS, intervals[0].StartTS); Assert.AreEqual(h1._EndTS, intervals[0].EndTS); Assert.AreEqual(c1._StartTS, intervals[1].StartTS); Assert.Null(intervals[1].EndTS); }