public void matches_one_of_the_arguments() { var arg1 = new Argument(typeof(string), "foo"); var arg2 = new Argument(typeof(string), "bar"); var frame1 = new FrameThatBuildsVariable("aaa", typeof(string)); var method = new GeneratedMethod("Something", typeof(Task), new Argument[] { arg1, arg2 }); method.ToArranger().FindVariableByName(typeof(string), "foo") .ShouldBeSameAs(arg1); method.ToArranger().FindVariableByName(typeof(string), "bar") .ShouldBeSameAs(arg2); }
public void created_by_one_of_the_frames() { var arg1 = new Argument(typeof(string), "foo"); var arg2 = new Argument(typeof(string), "bar"); var frame1 = new FrameThatBuildsVariable("aaa", typeof(string)); var frame2 = new FrameThatBuildsVariable("bbb", typeof(string)); var method = new GeneratedMethod("Something", typeof(Task), arg1, arg2) .Add(frame1, frame2); method.ToArranger().FindVariableByName(typeof(string), "aaa") .ShouldBeSameAs(frame1.Variable); method.ToArranger().FindVariableByName(typeof(string), "bbb") .ShouldBeSameAs(frame2.Variable); }
public void sourced_from_a_variable_source() { var arg1 = new Argument(typeof(string), "foo"); var arg2 = new Argument(typeof(string), "bar"); var frame1 = new FrameThatBuildsVariable("aaa", typeof(string)); var frame2 = new FrameThatBuildsVariable("bbb", typeof(string)); var method = new GeneratedMethod("Something", typeof(Task), new Argument[] { arg1, arg2 }); var source1 = new StubbedSource(typeof(string), "ccc"); var source2 = new StubbedSource(typeof(string), "ddd"); method.Sources.Add(source1); method.Sources.Add(source2); method.ToArranger().FindVariableByName(typeof(string), "ccc") .ShouldBeSameAs(source1.Variable); method.ToArranger().FindVariableByName(typeof(string), "ddd") .ShouldBeSameAs(source2.Variable); }
public void sad_path() { var arg1 = new Argument(typeof(string), "foo"); var arg2 = new Argument(typeof(string), "bar"); var frame1 = new FrameThatBuildsVariable("aaa", typeof(string)); var frame2 = new FrameThatBuildsVariable("bbb", typeof(string)); var method = new GeneratedMethod("Something", typeof(Task), new Argument[] { arg1, arg2 }); var source1 = new StubbedSource(typeof(string), "ccc"); var source2 = new StubbedSource(typeof(string), "ddd"); method.Sources.Add(source1); method.Sources.Add(source2); Exception <ArgumentOutOfRangeException> .ShouldBeThrownBy(() => { method.ToArranger().FindVariableByName(typeof(string), "missing"); }); }