예제 #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
파일: Program.cs 프로젝트: floradu88/kelpie
 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));
        }