Example #1
0
        public void TestConstructorWithDifferentArraySize()
        {
            // Arrange
            EmptyArrayGenerator <int> arrGenerator = new EmptyArrayGenerator <int>();

            int[] arraySizes = new[] { 0, 1, 2, 20, 50, 100, 1000 };

            // Assert
            foreach (var size in arraySizes)
            {
                string expexted = this.GenerateExpectedOutput(size);
                this.db = new Database <int>(arrGenerator.CreateArray(size));
                this.FillDatabase(size);
                string result = this.CreateDatabaseResultFetchString();

                Assert.AreEqual(expexted, result, $"Creating database with {size}, was not successfull.");
            }
        }
Example #2
0
        public static void Main()
        {
            // Generate array
            EmptyArrayGenerator <int> arrayGenerator = new EmptyArrayGenerator <int>();

            int[] array = arrayGenerator.CreateArray(DefaultSize);

            // Generate database
            Database <int> db = new Database <int>(array);

            // Reader
            IReader      reader = new ConsoleReader();
            IOutputStore output = new OutputStore();

            // Run program
            Engine engine = new Engine(reader, output, db);

            engine.Run();

            // Print report
            Console.WriteLine(output.GetOutput());
        }
Example #3
0
        public void InitializeDb()
        {
            EmptyArrayGenerator <int> arrGenerator = new EmptyArrayGenerator <int>();

            this.db = new Database <int>(arrGenerator.CreateArray(DefaultSize));
        }