public void ActionTimeTest3() { capt = new TestCapture(); ActionTimespan = 500; capt.imageReciever += testReciever1; capt.Start(); Thread.Sleep(5000); capt.Stop(); capt.imageReciever -= testReciever1; Assert.IsTrue(capt.ActionAverageTimespan <= ActionTimespan + SleepingTolerance && capt.ActionAverageTimespan > ActionTimespan); }
public void AftercaptureSleepTimeTest1() { capt = new TestCapture(); ActionTimespan = 0; int AfterCaptureSleepTime = 50; capt.imageReciever += testReciever1; capt.SetAfterCaptureSleeping(AfterCaptureSleepTime); capt.Start(); Thread.Sleep(5000); capt.Stop(); capt.imageReciever -= testReciever1; Assert.IsTrue(capt.CycleAverageTimespan <= AfterCaptureSleepTime + SleepingTolerance && capt.CycleAverageTimespan > AfterCaptureSleepTime); }
public void StopTest() { count = 0; capt = new TestCapture(); ActionTimespan = 0; capt.imageReciever += testReciever1; capt.Start(); Thread.Sleep(100); capt.Stop(); int temp = count; Thread.Sleep(200); Assert.IsTrue(temp != 0); capt.imageReciever -= testReciever1; Assert.AreEqual(temp, count); count = 0; }
public void SetAfterCaptureSleepingTest() { capt = new TestCapture(); ActionTimespan = 50; capt.imageReciever += testReciever1; capt.Start(); Thread.Sleep(5000); capt.Pause(); Thread.Sleep(200); Assert.IsTrue(capt.CycleAverageTimespan <= ActionTimespan + SleepingTolerance && capt.CycleAverageTimespan > ActionTimespan); capt.PauseRelease(); Thread.Sleep(200); int AfterCaptureSleepTime = 150; capt.SetAfterCaptureSleeping(AfterCaptureSleepTime); Thread.Sleep(10000); capt.Stop(); Assert.IsTrue(capt.CycleAverageTimespan <= AfterCaptureSleepTime + ActionTimespan + SleepingTolerance * 2 && Math.Abs(capt.CycleAverageTimespan - (AfterCaptureSleepTime + ActionTimespan)) / (AfterCaptureSleepTime + ActionTimespan) < 0.1); capt.imageReciever -= testReciever1; }