Beispiel #1
0
    void LoopIt(LoopMethods method)
    {
        for (int iX = 0; iX < size.x; iX++)
        {
            for (int iY = 0; iY < size.y; iY++)
            {
                for (int iZ = 0; iZ < size.z; iZ++)
                {
                    Vector3Int index = new Vector3Int(iX, iY, iZ);

                    switch (method)
                    {
                    case LoopMethods.TrueField:
                        TrueField(index);
                        break;

                    case LoopMethods.DisableRandom:
                        DisableRandom(index);
                        break;

                    case LoopMethods.MakeHollow:
                        MakeHollow(index);
                        break;
                    }
                }
            }
        }
    }
        public void ForEachTest()
        {
            //ACT
            int[] nums   = { 1, 2, 3, 4, 5 };
            var   result = LoopMethods.LowestForEach(nums);

            //ASSERT
            Assert.AreEqual(1, result);
        }
        public void calcDiv(int num1, int num2)
        {
            //ACT
            var exception = Assert.Throws <ArgumentException>(() =>
                                                              LoopMethods.calcDiv(num1, num2));

            //ASSERT
            Assert.AreEqual($"Can not divide by {num2}", exception);
        }
        public void LowestForLoopMethodTest()
        {
            //ACT
            int[] nums   = { 5, 10, 15, 16, 5, 2 };
            var   result = LoopMethods.LowestForLoop(nums);

            //ASSERT
            Assert.AreEqual(2, result);
        }