-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathTesting.cs
53 lines (44 loc) · 1.31 KB
/
Testing.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Meadow.Contract;
using System;
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Runtime.Serialization;
using System.Management.Automation.Internal;
using System.Globalization;
namespace Meadow.Cli
{
public delegate string AddDelegate(int num1, int num2);
public class AdderClass
{
public string Add(int num1, int num2)
{
return (num1 + num2).ToString(CultureInfo.InvariantCulture);
}
}
[Cmdlet("Test", "Function")]
[OutputType(typeof(AdderClass))]
public class TestFunctionCommand : PSCmdlet
{
protected override void BeginProcessing()
{
System.Console.WriteLine("test begin process");
base.BeginProcessing();
}
protected override void ProcessRecord()
{
System.Console.WriteLine("test process record");
string AddTest(int p1, int p2)
{
return (p1 + p2).ToString(CultureInfo.InvariantCulture);
}
AddDelegate myDel = AddTest;
//base.ProcessRecord();
//WriteObject(myDel);
WriteObject(new AdderClass());
}
protected override void EndProcessing()
{
System.Console.WriteLine("test end process");
}
}
}