Example #1
0
        public async void Export(string outputFile, AstronomicalChart chart)
        {
            using (var writer = new StreamWriter(outputFile))
            {
                await writer.WriteLineAsync("digraph D {");

                await Write(chart.Root, writer);

                await writer.WriteLineAsync("}");
            }
        }
Example #2
0
        public void Build_a_chart_1_satellite_at_depth_1()
        {
            var chart = new AstronomicalChart(new AstronomicalObject("com"));
            var a     = new AstronomicalObject("a");

            chart.Root.AddSatellite(a);

            var calculator = new ChecksumCalculator();
            var checksum   = calculator.GetChecksum(chart);

            Assert.AreEqual(1, checksum);
        }
Example #3
0
        public void Build_a_chart_4_satellites_at_depth_1_and_2()
        {
            var chart = new AstronomicalChart(new AstronomicalObject("com"));
            var a     = new AstronomicalObject("a");

            chart.Root.AddSatellite(a);
            var a2 = new AstronomicalObject("a");

            a.AddSatellite(a2);
            var b = new AstronomicalObject("b");

            chart.Root.AddSatellite(b);
            var b2 = new AstronomicalObject("b2");

            a.AddSatellite(b2);

            var calculator = new ChecksumCalculator();
            var checksum   = calculator.GetChecksum(chart);

            Assert.AreEqual(6, checksum);
        }
Example #4
0
        public int GetChecksum(AstronomicalChart chart)
        {
            var total = GetChecksum(chart.Root, 1);

            return(total);
        }