Exemplo n.º 1
0
    public static void Main()
    {
        SimpleMath sm = new SimpleMath();
        // ������ ���� �Ͻ������� ����
        sm.mmDelegate += ( (msg, result) => {
                Console.WriteLine(msg);
                Console.WriteLine("result : {0}", result);
            });
        // ������ ���� ��������� ����
        sm.mmDelegate += ( (string msg, int result) => {
                Console.WriteLine("2:{0}", msg);
                Console.WriteLine("2:result : {0}", result);
            });

        // ���� ������ �ٸ� (����!!!)
        // sm.mmDelegate += ( (string msg) => {
        // 		Console.WriteLine("2:{0}", msg);
        // 	});

        // ���� ������ �Ϻθ� �����(����!!!)
        // sm.mmDelegate += ( (string msg, result) => {
        // 		Console.WriteLine("2:{0}", msg);
        // 		Console.WriteLine("2:result : {0}", result);
        // 	});

        sm.addHook += ( () => {
                Console.WriteLine("AddWork is hooked!");
            });

        sm.Add (10, 11);
    }
        public TypeAndMethodNamerTest()
        {
            RecordingServices.RecordingSaver = new DoNotSaveRecordings();
            recorder = (DefaultRecorder)RecordingServices.Recorder;
            RecordingServices.RecordingNamer = new TypeAndMethodNamer();

            simpleMath = new SimpleMath();
        }
        public CallStackNamingOfRecordingTest()
        {
            recorder = (DefaultRecorder)RecordingServices.Recorder;
            RecordingServices.RecordingNamer = new CallStackRecordingNamer();

            simpleMath = new SimpleMath();
            simpleMathFacade = new SimpleMathFacade();
        }
Exemplo n.º 4
0
 static void Main()
 {
     SimpleMath simple = new SimpleMath();
     int sum = simple.Add(2, 2);
     Console.WriteLine("2 + 2 = {0}", sum);
     ComplexMath complex = new ComplexMath();
     int square = complex.Square(3);
     Console.WriteLine("3 squared = {0}", square);
 }
        public TestWriterTest()
        {
            var saveRecordings = new SaveRecordingsToMemory();
            RecordingServices.RecordingSaver = saveRecordings;
            fileSystem = new CodeGenerationFileSystem();
            testWriter = new TestWriter(saveRecordings, fileSystem);

            math = new SimpleMath();
            we_have_generated_a_test_class();
        }
Exemplo n.º 6
0
 static void LambdaExpressionsMultipleParams()
 {
     SimpleMath m = new SimpleMath();
     // register with delegate as lambda expression
     m.SetMathHandler((msg, result) =>
     {
         Console.WriteLine("Message: {0}, Result: {1}", msg, result);
     });
     m.zzDelegate += () => { Console.WriteLine("sup homes"); return "sup"; };
     // this will trigger the lambda expressions
     m.Add(10, 10);
 }
        protected TestsWithFlavour()
        {
            Configuration.TestFlavour = GetFlavour();

            var saveRecordings = new SaveRecordingsToMemory();
            RecordingServices.RecordingSaver = saveRecordings;

            fileSystem = new CodeGenerationFileSystem();
            testWriter = new TestWriter(saveRecordings, fileSystem);

            math = new SimpleMath();
            we_have_generated_a_test_class();
        }
        public RecordingAttributeTest()
        {
            saverMock = new Mock<ISaveRecordings>();
            saverMock.Setup(saver => saver.SaveMethodRecording(It.IsAny<MethodRecording>())).Verifiable();

            RecordingServices.RecordingSaver = saverMock.Object;
            RecordingServices.RecordingNamer = new TypeAndMethodNamer();
            recorder = (DefaultRecorder)RecordingServices.Recorder;
            recorder.ClearRecordings();

            math = new SimpleMath();
            math.Add(5, 5);
            math.Add(10, 10);
            SimpleMath.AddStatic(15, 15);
        }
Exemplo n.º 9
0
    static void Main()
    {
       SimpleMath obj = new SimpleMath();

       //<Snippet45>
       int result = obj.AddTwoNumbers(1, 2);
       result = obj.SquareANumber(result);
       // The result is 9.
       Console.WriteLine(result);
       //</Snippet45>

       //<Snippet46>
       result = obj.SquareANumber(obj.AddTwoNumbers(1, 2));
       // The result is 9.
       Console.WriteLine(result);
       //</Snippet46>
    }
 public SimpleMathFacade()
 {
     _math = new SimpleMath();
 }
 private void Awake()
 {
     mathObjectCache = GetComponent<SimpleMath>();
 }
 private void Awake()
 {
     // cache the object references
     mathObjectCache = GetComponent<SimpleMath>();
     cameraTransformCache = transform;
 }
Exemplo n.º 13
0
 private void Awake()
 {
     mathObjectCache = GetComponent<SimpleMath>();
     pos1Cache = transform.position;
 }