public void TestHikStreamCombine_ShortOrLarge() { HikStreamCombine hsc = new HikStreamCombine(); var array = hsc.Update(beginTime, new byte[5]); Assert.AreEqual(1, array.Count); Assert.AreEqual(5, array[0].First().Buffer.Length); Assert.AreEqual(beginTime, array[0].First().Time); beginTime = beginTime.AddSeconds(1); var largeArr = hsc.Update(beginTime, new byte[50000000]); Assert.AreEqual(1, largeArr.Count); Assert.AreEqual(50000000, largeArr[0].First().Buffer.Length); Assert.AreEqual(beginTime, largeArr[0].First().Time); }
public void TestHikStreamCombine_Combine() { HikStreamCombine hsc = new HikStreamCombine(); Assert.AreEqual(0, hsc.Update(beginTime, new byte[5120]).Count); Assert.AreEqual(0, hsc.Update(beginTime.AddMilliseconds(1), new byte[5120]).Count); Assert.AreEqual(0, hsc.Update(beginTime.AddMilliseconds(2), new byte[5120]).Count); Assert.AreEqual(0, hsc.Update(beginTime.AddMilliseconds(3), new byte[5120]).Count); Assert.AreEqual(0, hsc.Update(beginTime.AddMilliseconds(4), new byte[5120]).Count); Assert.AreEqual(0, hsc.Update(beginTime.AddMilliseconds(5), new byte[5120]).Count); var array = hsc.Update(beginTime.AddMilliseconds(6), new byte[1120]); Assert.AreEqual(1, array.Count); Assert.AreEqual(beginTime, array[0].First().Time); Assert.AreEqual(5120 * 6 + 1120, array[0].Sum(_ => _.Buffer.Length)); }