public void Test1() { var example = new MethodExample(); int value = 20; Person person = new Person() { Age = 20 }; //var key = person.generateKey(2); //person.IsVisible((dynamic)key); int result2; example.Add(ref value, person, out result2); int result = value; int resultAge = person.Age; var resultJoin = example.Join(",", new string[] { "Tom", "Jack" }); // Debugger.Break(); result.ShouldBe(20); resultAge.ShouldBe(40); }
static MethodInfo GetMethodExampleBodyInfo(ExampleBase baseExample) { // core logic taken from https://github.com/osoftware/NSpecTestAdapter/blob/master/NSpec.TestAdapter/Discoverer.cs const string methodInfoPrivateFieldName = "method"; MethodExample example = (MethodExample)baseExample; var info = example.GetType() .GetField(methodInfoPrivateFieldName, BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(example) as MethodInfo; return(info); }
protected override FixtureData BuildFixtureData() { Action someAction = DummyMethod; MethodInfo methodInfo = someAction.Method; ExampleBase someExample = new MethodExample( methodInfo, "tag1 tag2_more tag3"); string someMethodName = methodInfo.Name; return(new FixtureData() { Example = someExample, MethodName = someMethodName, }); }
static void Main() { var example = new MethodExample(); example.OptionalArgumentMethod(); example.OptionalArgumentMethod(12); example.OptionalArgumentMethod(y: "Goodbye"); example.ParamsMethod("required", "one", "two"); // This is the same as example.ParamsMethod("required", new string[] { "one", "two" }); // What do you think this does? example.ParamsMethod("required"); }