Beispiel #1
0
        public void ProgramMain_miss_when_0_0_first()
        {
            using (ConsoleOutput cout = new ConsoleOutput())
            {
                using (ConsoleInput cin = new ConsoleInput(new List<Double> {
                    3.5, 4.5,
                    0.0, 0.0 }))
                {
                    Biathlon.Program.Main();

                    string expected = String.Format(
                        "Biathlon{0}Initial X: Initial Y: " +
                        "X: Y: " +
                        "There was no hit{0}",
                        Environment.NewLine);
                    Assert.AreEqual(expected, cout.GetOuput());
                }
            }
        }
Beispiel #2
0
        public void ProgramMain_hit_third()
        {
            using (ConsoleOutput cout = new ConsoleOutput())
            {
                using (ConsoleInput cin = new ConsoleInput(new List<Double> {
                    3.5, 4.5,
                    10.0, 1.0, -2, -10, 3.0, 4.0, 0.0, 0.0 }))
                {
                    Biathlon.Program.Main();

                    string expected = String.Format(
                        "Biathlon{0}Initial X: Initial Y: " +
                        "X: Y: " +
                        "X: Y: " +
                        "X: Y: " +
                        "You hit it!{0}",
                        Environment.NewLine);
                    Assert.AreEqual(expected, cout.GetOuput());
                }
            }
        }
Beispiel #3
0
        public void ShootingRangeSearchFirstNearest_miss_when_0_0_first()
        {
            using (ConsoleInput cin = new ConsoleInput(new List<Double> { 0.0, 0.0 }))
            {
                Point p = new Point(3.5, 4.5);
                Point result = cut.SearchFirstNearest(p, 3.0);

                Assert.IsNull(result);
            }
        }
Beispiel #4
0
        public void ShootingRangeSearchFirstNearest_miss_when_radius_2_distance_large()
        {
            using (ConsoleInput cin = new ConsoleInput(new List<Double> { 3.0, 4.0, 0.0, 0.0 }))
            {
                Point p = new Point(13.5, 14.5);
                Point result = cut.SearchFirstNearest(p, 2.0);

                Assert.IsNull(result);
            }
        }
Beispiel #5
0
        public void ShootingRangeSearchFirstNearest_hit_third()
        {
            using (ConsoleInput cin = new ConsoleInput(new List<Double> { 10.0, 1.0, -2, -10, 3.0, 4.0, 0.0, 0.0 }))
            {
                Point p = new Point(3.5, 4.5);
                Point result = cut.SearchFirstNearest(p, 3.0);

                Assert.IsNotNull(result);
                Assert.AreEqual(3.0, result.X);
                Assert.AreEqual(4.0, result.Y);
            }
        }