Exemple #1
0
        public void StandardWriteDoesNotLog()
        {
            CsvLogger logger = new CsvLogger();

            logger.Write("Foo");
            logger.GetClipboardData().Data.Should().BeNull();
        }
        public void SetTarget_Unset_Throws()
        {
            CsvLogger logger = new CsvLogger();

            Assert.Throws <Exception>(delegate
            {
                logger.Write(new LogMessage());
            });
        }
        public void Write_EmptyMessage_AppearsInFile()
        {
            CsvLogger logger = new CsvLogger();

            logger.SetTarget(".\\file.txt");

            logger.Write(new LogMessage());
            string text = File.ReadAllText(".\\file.txt");

            Assert.AreEqual("", text.Trim());
        }
Exemple #4
0
        public void TableLogs()
        {
            Table table = Table.Create(1, 1);

            table.AddRow("One", "Two");
            table.AddRow("Three", "Four");

            CsvLogger logger = new CsvLogger();

            logger.Write(table);
            Stream stream = logger.GetClipboardData().Data as Stream;

            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            reader.ReadToEnd().Should().Be("\"One\",\"Two\"\r\n\"Three\",\"Four\"\r\n");
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var nsgaFactory   = new NsgaSolverFactory(new Random());
            var configuration = new ConfigurationProvider().GetConfiguration();

            configuration.PopulationSize = 300;
            configuration.MaxIterations  = 400;

            var mathSolver = nsgaFactory.GetMathSolver(configuration);

            var result = mathSolver.Solve();

            CsvLogger.RegisterLogger("math");

            foreach (var res in result.Fronts.First().Select(i => i.Evaluations))
            {
                CsvLogger.AddRow("math", new dynamic[] { res[0].Score, res[1].Score });
            }

            CsvLogger.Write("math", "math.csv");

            Console.WriteLine("done");
        }