Пример #1
0
        public void import_should_persist_data_to_the_repository()
        {
            // Arrange
            string[] args = { "--import" };

            var server1 = CreateFakeServer("JabberWocky1");

            var environment = new Environment();
            environment.Name = "PRODUCTION";
            environment.Servers.Add(server1);

            var config = new ConfigurationMock();
            config.Environments.Add(environment);

            var repository = new RepositoryMock();
            var runner = new Runner(config, repository);

            // Act
             runner.Run(args);

            // Assert
            string output = _consoleWriter.ToString();
            Assert.That(output, Is.StringContaining("Finished."));
            Assert.That(repository.LogEntries.Count, Is.EqualTo(FULL_LOG_ROW_COUNT));
        }
Пример #2
0
        public void environment_arg_should_scan_a_single_environment()
        {
            // Arrange
            string[] args = { "--environment=DEV", "--import" };

            var server1 = CreateFakeServer("JabberWocky1");
            var server2 = CreateFakeServer("JabberWocky2");

            var environmentProd = new Environment();
            environmentProd.Name = "PRODUCTION";
            environmentProd.Servers.Add(server1);

            var environmentDev = new Environment();
            environmentDev.Name = "DEV";
            environmentDev.Servers.Add(server1);
            environmentDev.Servers.Add(server2);

            var config = new ConfigurationMock();
            config.Environments.Add(environmentProd);
            config.Environments.Add(environmentDev);

            var repository = new RepositoryMock();
            var runner = new Runner(config, repository);

            // Act
            runner.Run(args);

            // Assert
            string output = _consoleWriter.ToString();
            Assert.That(output, Is.StringContaining("Finished."));
            Assert.That(repository.LogEntries.Count, Is.EqualTo(FULL_LOG_ROW_COUNT * 2));
        }
Пример #3
0
 static void Main(string[] args)
 {
     try
     {
         var runner = new Runner();
         runner.Run(args);
     }
     catch (InvalidConfigurationFileException e)
     {
         Console.Error.WriteLine("Error: {0}", e.Message);
         Environment.Exit(1);
     }
 }
Пример #4
0
        public void no_arguments_should_display_help(string args)
        {
            // Arrange
            var repository = new RepositoryMock();
            var config = new ConfigurationMock();
            var runner = new Runner(config, repository);

            // Act
            runner.Run(new string[] {args});

            // Assert
            string output = _consoleWriter.ToString();
            Assert.That(output, Is.StringContaining("Kelpie import tool"));
            Assert.That(output, Is.StringContaining("--help"));
        }
Пример #5
0
        public void wipedata_arg_should_clear_the_repository()
        {
            // Arrange
            string[] args = { "--wipedata" };

            var repository = new RepositoryMock();
            repository.LogEntries.Add(new LogEntry());
            repository.LogEntries.Add(new LogEntry());

            var config = new ConfigurationMock();
            var runner = new Runner(config, repository);

            // Act
            runner.Run(args);

            // Assert
            string output = _consoleWriter.ToString();
            Assert.That(output, Is.StringContaining("Finished."));
            Assert.That(repository.LogEntries.Count, Is.EqualTo(0));
        }