public void Returns_Null_When_Empty() { RegionPipe target = new RegionPipe(); object result = target.Run(new object()); Assert.IsNull(result, "The RegionPipe is running even when there is no regions in it."); }
public void Runs_When_Not_Empty() { Region region = new Region((object obj) => { return(obj); }); RegionPipe target = new RegionPipe(); target.Add(region); object result = target.Run("Result"); Assert.AreEqual(result, "Result", "The RegionPipe Run method does not returns the correct value"); }
public void Return_Value_Is_Same_Object_Than_Input() { Region region = new Region((object obj) => { return(obj); }); RegionPipe target = new RegionPipe(); target.Add(region); object inputObj = new object(); object result = target.Run(inputObj); Assert.AreSame(result, inputObj, "The RegionPipe Run method did not return the same object(reference) as the input"); }
static void Main(string[] args) { V1 v1 = new V1(); V2 v2 = new V2(); List <IRegion> regions = new List <IRegion>() { v1, v2 }; RegionPipe pipe = new RegionPipe(regions); string result = pipe.Run(string.Empty) as string; Console.WriteLine("=========THE PIPE FINISHED RUNNING========="); Console.WriteLine("V1 output: \"{0}\", Elapsed Time: {1}", v1.Result, v1.ElapsedTime); Console.WriteLine("V2 output: \"{0}\", Elapsed Time: {1}", v2.Result, v2.ElapsedTime); Console.WriteLine("Pipe output: \"{0}\"", result); Console.ReadLine(); }
static void Main(string[] args) { V1 v1 = new V1(); V2 v2 = new V2(); List <IRegion> regions = new List <IRegion>() { v1, v2 }; RegionPipe pipe = new RegionPipe(regions); dynamic result = pipe.Run(new { src1 = new Mat("images/box.png", ImreadModes.Color), src2 = new Mat("images/box_in_scene.png", ImreadModes.Color) }); using (new Window("SURF matching (by BFMather)", WindowMode.AutoSize, result.bfView)) using (new Window("SURF matching (by FlannBasedMatcher)", WindowMode.AutoSize, result.flannView)) { Cv2.WaitKey(); } }
public void Runs_Regions_In_Correct_Order() { Region region1 = new Region((object obj) => { string str = obj as string; return(str + "region1_"); }); Region region2 = new Region((object obj) => { string str = obj as string; return(str + "region2"); }); List <IRegion> regions = new List <IRegion>() { region1, region2 }; RegionPipe target = new RegionPipe(regions); object result = target.Run(string.Empty); Assert.AreEqual(result, "region1_region2"); }