public void FeedHamster_Case7()
        {
            // Assign
            int foodSupplies = 20000;
            int hamsterCount = 10;
            var hamsters     = new List <Hamster>(hamsterCount);
            var cage         = new hamstr.Hamstr();

            hamsters.Add(new Hamster(1, 5000, hamsterCount));
            hamsters.Add(new Hamster(1, 5000, hamsterCount));

            for (int i = 0; i < hamsterCount - 2; i++)
            {
                hamsters.Add(new Hamster(10000, 1, hamsterCount));
            }

            // Act
            int result = cage.FeedHamsters(foodSupplies, hamsters.ToArray());

            // Assert
            int expected     = 2;
            var errorMessage = $"Expected: {expected}, Actual: {result}";

            Assert.AreEqual(expected, result, errorMessage);
        }
        public void FeedHamster_Case8()
        {
            // Assign
            int foodSupplies = 0;
            int hamsterCount = 1;
            var hamsters     = new List <Hamster>(hamsterCount);
            var cage         = new hamstr.Hamstr();

            hamsters.Add(new Hamster(10, 0, hamsterCount));

            // Act
            int result = cage.FeedHamsters(foodSupplies, hamsters.ToArray());

            // Assert
            int expected     = 0;
            var errorMessage = $"Expected: {expected}, Actual: {result}";

            Assert.AreEqual(expected, result, errorMessage);
        }
Пример #3
0
        private static void Main(string[] args)
        {
            var hamstr = new Hamstr();
            string inputFileName;
            string outputFileName;

            if (args == null || args.Length == 0)
            {
                inputFileName = "hamstr.in";
                outputFileName = "hamstr.out";
            }
            else if (args.Length == 2)
            {
                inputFileName = args[0];
                outputFileName = args[1];
            }
            else
            {
                Console.WriteLine("Command line parameters violation!");
                return;
            }

            hamstr.Run(inputFileName, outputFileName);
        }
        private static void Main(string[] args)
        {
            var    hamstr = new Hamstr();
            string inputFileName;
            string outputFileName;

            if (args == null || args.Length == 0)
            {
                inputFileName  = "hamstr.in";
                outputFileName = "hamstr.out";
            }
            else if (args.Length == 2)
            {
                inputFileName  = args[0];
                outputFileName = args[1];
            }
            else
            {
                Console.WriteLine("Command line parameters violation!");
                return;
            }

            hamstr.Run(inputFileName, outputFileName);
        }