Пример #1
0
    private void Start()
    {
        Operation op1 = (x, y) => x + y;

        Debug.Log(op1(0, 1));

        Operation op2 = (x, y) => x - y;

        Debug.Log(op2(0, 1));

        OperationFactorial opFactorial = (x) => Factorial(x);

        Debug.Log(opFactorial(factorial));

        OperationFactorial operationFactorial = delegate(int x)
        {
            //не знаю, что не
            Factorial(factorial);
            return(factorial);
        };

        Debug.Log(operationFactorial(factorial));

        StringSum stringSum = (a, b) => message1 + message2;

        Debug.Log(stringSum(message1, message2));

        Message message;

        message = MyMessage;
        message("Делегаты");
        message("это круто");
        message("Делегаты это круто");
    }
Пример #2
0
        public void StrSumTest_5_578_583()
        {
            string str1     = "5";
            string str2     = "578";
            string expected = "583";

            StringSum stringSum = new StringSum();
            string    check     = stringSum.TwoStrSum(str1, str2);

            Assert.AreEqual(expected, check);
        }
Пример #3
0
 static void Main(string[] args)
 {
     Question1.Test();
     EvaluateReversePolishNotation.Test();
     MedianTwoSortedArrays.Test();
     StringSum.Test();
     LongestSubstringWithoutRepeatingChar.Test();
     CustomSort.Test();
     MergeIntervals.Test();
     RegexMatch.Test();
     StringToInt.Test();
 }
 public void Setup()
 {
     _stringSum = new StringSum();
 }
Пример #5
0
 public void Sum_TwoEmptyStrings_ShouldReturnZero()
 {
     Assert.AreEqual("0", StringSum.Sum("", ""));
 }
Пример #6
0
 public void Sum_OneNotNaturalNumber_ShouldReturnSecondNumber()
 {
     Assert.AreEqual("1", StringSum.Sum("-1", "1"));
 }
Пример #7
0
 public void Sum_TwoNaturalNumbers_ShouldReturnTheirSum()
 {
     Assert.AreEqual("2", StringSum.Sum("1", "1"));
 }