示例#1
0
        public void TestMethodDefaultMethod3()
        {
            List <string>    methodsCalled = new List <string>();
            BeethovenFactory factory       = new BeethovenFactory();
            ITestMethods     test          = factory.Generate <ITestMethods>(
                new DefaultMethod((methodInfo, _) => methodsCalled.Add(methodInfo.Name)));

            test.Simple();
            test.ReturnValue();
            test.WithParameters("as", "wefewf");
            test.WithParameters("", null, 5);
            string b = "";

            test.OutAndRef(out string a, ref b, 5);
            int value = 0;

            test.Ref(ref value);
            test.GetMain("klkl", "kklklklkk");
            test.NoReturnValue("", "");
            CollectionAssert.AreEquivalent(new[]
            {
                "Simple",
                "ReturnValue",
                "WithParameters",
                "WithParameters",
                "OutAndRef",
                "Ref",
                "GetMain",
                "NoReturnValue"
            },
                                           methodsCalled);
        }
示例#2
0
        public void LinkedMethodsReturnValueTest3()
        {
            PartialMethods   partialMethods   = new PartialMethods();
            BeethovenFactory beethovenFactory = new BeethovenFactory();
            ITestMethods     instance         = beethovenFactory.Generate <ITestMethods>(
                new LinkedMethodsReturnValue(nameof(ITestMethods.GetMain))
                .PartialMatchMethod <ITestMethods>(partialMethods, "testMethods"));
            object actual = instance.GetMain("w", "sd");

            Assert.AreEqual(instance, actual);
        }