static void Main(string[] args) { ActionTest target = new ActionTest(); MethodTest instance = new MethodTest(); target.DoExpressionAction(() => instance.Method1().Method2()); Console.ReadLine(); }
public async Task TestInvokeMethodAsync() { var obj = new MethodTest(); var type = obj.GetType(); // Verifies that call method correctly await(Task) type.InvokeMethod("AddAsync", obj, 5); Assert.Equal(5, obj.Count); // Verifies that not find method await Assert.ThrowsAsync <NullReferenceException>(async() => { await(Task) type.InvokeMethod("NoMethod", obj, 1); }); }
public void TestInvokeMethod() { var obj = new MethodTest(); var type = obj.GetType(); // Verifies that call method correctly type.InvokeMethod("Add", obj, 5); Assert.Equal(5, obj.Count); // Verifies that not find method Assert.Throws <NullReferenceException>(() => { type.InvokeMethod("NoMethod", obj, 1); }); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange string value = "this1 is a test"; string sum = "This_Is_A_Test"; //act string result = method.Capitalize(value); //assert Assert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange string value = "test"; string sum = "word"; //act string result = method.StrType(value); //assert Assert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange string value = "this is a test"; string sum = "This Is A Test"; //act string result = method.UppercaseFirstEach(value); //assert Assert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange string value = "test"; int sum = 4; //act int result = method.StrCount(value); //assert Assert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange int value = 123; int sum = 131; //act int result = method.NextPalindrome(value); //assert Assert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange string[] value = { "This", "is", "a", "test" }; string[] sum = { "This is a test" }; //act string[] result = method.ConcatArrayWithSpace(value); //assert CollectionAssert.AreEqual(sum, result); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange int value = 113; int[] sum = { 113, 127, 131 }; //act int[] result = method.NextPrime(value); //assert CollectionAssert.AreEqual(sum, result); }
public TestClass() { AccModTest = new AccessModifierTest(); ArrTest = new ArrayTest(); ETest = new EnumTest(); IdentTest = new IdentifierTest(); MethTest = new MethodTest(); SpecExpTest = new SpecialExpressionsTest(); AssignTest = new AssignmentTest(); OpEqTest = new OpEqTest(); Suffixes = new Suffixes(); Constants = new TermConstants(); Override = new OverrideTest(); OpOver1 = new OpOverload(); OpOver2 = new OpOverload(); }
public void TestMethod1() { MethodTest method = new MethodTest(); //arrange int value1 = 5; int value2 = 3; int sum = 4; //act int result = method.Average(value1, value2); //assert Assert.AreEqual(sum, result); }
public static void ServerObjParameter(MethodTest obj, MethodReturnEventArgs<TestObjClass> e, TestObjClass input) { var ctx = obj.Context; var newA = ctx.Create<TestObjClass>(); newA.StringProp = "A"; var kundeA = ctx.Create<Kunde>(); kundeA.Kundenname = "Kunde A"; kundeA.PLZ = "1210"; newA.ObjectProp = kundeA; var newB = ctx.Create<TestObjClass>(); newB.StringProp = "B"; var kundeB = ctx.Create<Kunde>(); kundeB.Kundenname = "Kunde"; kundeB.PLZ = "1210"; newB.ObjectProp = kundeB; e.Result = input ?? newA; }
public static void ServerMethod(MethodTest obj) { }
private static void Basic() { // 1. DataType Console.WriteLine("=================== Data Type ================"); var dt = new DataType(); dt.Test(); // 2. Variable And Constant Console.WriteLine("=================== Variable & Constant ================"); var vnc = new VariableAndConstant(); vnc.Test(); // 3. Array Console.WriteLine("=================== Array ================"); var arr = new ArrayTest(); arr.Test(); // 4. String Console.WriteLine("=================== String ================"); var strTest = new StringTest(); strTest.Test(); // 5. Enum Console.WriteLine("=================== Enum ================"); var enumTest = new EnumTest(); enumTest.Test(); // 6. Operator Console.WriteLine("=================== Operator ================"); var operatorTest = new OperatorTest(); operatorTest.Test(); // 7. If Console.WriteLine("=================== If ================"); var ifTest = new IfTest(); ifTest.Test(); // 8. loop Console.WriteLine("=================== Loop ================"); var loopTest = new LoopTest(); loopTest.Test(); // 9. yield keword: when collection data can be returned one by one in turn Console.WriteLine("=================== yield return ================"); var yieldReturnTest = new yieldTest(); yieldReturnTest.Test(); // 10. Exception Console.WriteLine("=================== Exception ================"); var exceptionTest = new ExceptionTest(); exceptionTest.Test(0, 0); // 11. Struct Console.WriteLine("=================== Struct ================"); var structTest = new StructTest(); structTest.ToString(); // 12. Nullable Console.WriteLine("=================== Nullable ================"); var nullableTest = new NullableTest(); nullableTest.Test(null, null, DateTime.Now, null); // 13. Method Console.WriteLine("=================== Method ================"); var methodTest = new MethodTest(); // 13-1 int val = 1000; methodTest.TestPassByValue(val); Console.WriteLine("variable val's value is not changed: {0}", val); // 13-2 int x = 0; double y = 1.0; double ret = methodTest.TestPassByRef(ref x, ref y); Console.WriteLine("variable val's value is actually changed: x: {0} y: {1}", x, y); Console.WriteLine(x); Console.WriteLine(y); // 13-3 int c, d; bool bret = methodTest.TestPassByOut(10, 20, out c, out d); Console.WriteLine("variable val's value is actually changed: c: {0} d: {1}", c, d); // differenc between ref keyword and out keyword // 13-4. var returnValue = methodTest.TestDefaultParam(1, 2); Console.WriteLine("Default parameter test: " + returnValue); var returnValue2 = methodTest.TestDefaultParam(1, 2, "-----"); // 13-5. var returnParamsValue = methodTest.TestParams(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Console.WriteLine("params keyword test: " + returnParamsValue); }