[longomatch] Use ResetCalls to reuse the existing mocks
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Use ResetCalls to reuse the existing mocks
- Date: Tue, 31 Mar 2015 17:32:24 +0000 (UTC)
commit dd2e11d48dc48d4e121e780fb4ab199b4c4ec4d3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Mar 23 18:11:44 2015 +0100
Use ResetCalls to reuse the existing mocks
Tests/Services/TestRenderingJobsManager.cs | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/Tests/Services/TestRenderingJobsManager.cs b/Tests/Services/TestRenderingJobsManager.cs
index 0074028..55a10bf 100644
--- a/Tests/Services/TestRenderingJobsManager.cs
+++ b/Tests/Services/TestRenderingJobsManager.cs
@@ -55,6 +55,8 @@ namespace Tests.Services
var mtk = Mock.Of<IMultimediaToolkit> (m => m.GetVideoEditor () ==
Mock.Of<IVideoEditor> ());
// and guitoolkit
var gtk = Mock.Of<IGUIToolkit> (g => g.RenderingStateBar ==
Mock.Of<IRenderingStateBar> ());
+ // and a video editor
+ Mock<IVideoEditor> mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
// And eventbroker
Config.EventsBroker = Mock.Of<EventsBroker> ();
@@ -64,14 +66,12 @@ namespace Tests.Services
renderer.AddJob (job);
// Check that AddSegment is called with the right video file.
- Mock<IVideoEditor> mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
mock.Verify (m => m.AddSegment (p.Description.FileSet [0].FilePath,
evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true),
Times.Once ());
/* Test with a camera index bigger than the total cameras */
- mtk = Mock.Of<IMultimediaToolkit> (m => m.GetVideoEditor () ==
Mock.Of<IVideoEditor> ());
- renderer = new RenderingJobsManager (mtk, gtk);
- mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
+ renderer.CancelAllJobs ();
+ mock.ResetCalls ();
evt = p.Timeline [1];
evt.CamerasVisible = new List<int> { 1 };
element = new PlaylistPlayElement (evt, p.Description.FileSet);
@@ -82,9 +82,8 @@ namespace Tests.Services
evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true),
Times.Once ());
/* Test with the secondary camera */
- mtk = Mock.Of<IMultimediaToolkit> (m => m.GetVideoEditor () ==
Mock.Of<IVideoEditor> ());
- renderer = new RenderingJobsManager (mtk, gtk);
- mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
+ renderer.CancelAllJobs ();
+ mock.ResetCalls ();
evt = p.Timeline [1];
evt.CamerasVisible = new List<int> { 2 };
element = new PlaylistPlayElement (evt, p.Description.FileSet);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]