Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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,
            });
        }
Ejemplo n.º 4
0
    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");
    }