示例#1
0
        public void OptimumWeatherTest()
        {
            var p1          = new CartesianCoordinates(0, 1);
            var p2          = new CartesianCoordinates(1, 0);
            var p3          = new CartesianCoordinates(2, -1);
            var solarSystem = new SolarSystem(new List <Planet>()
            {
                new Planet(p1.ToPolar().Length, p1.ToPolar().Angle.ToDegrees(), 0, Planet.Direction.CLOCKWISE),
                new Planet(p2.ToPolar().Length, p2.ToPolar().Angle.ToDegrees(), 0, Planet.Direction.CLOCKWISE),
                new Planet(p3.ToPolar().Length, p3.ToPolar().Angle.ToDegrees(), 0, Planet.Direction.CLOCKWISE)
            });

            Assert.Equal(Weather.WeatherType.OPTIMUM, solarSystem.CalculateWeather().Type);
        }
示例#2
0
        public void CartesianToPolarToCartesian()
        {
            var cartesian    = new CartesianCoordinates(10, 2);
            var polar        = cartesian.ToPolar();
            var newCartesian = polar.ToCartesian();

            Assert.Equal(cartesian.X, newCartesian.X, 10);
            Assert.Equal(cartesian.Y, newCartesian.Y, 10);
        }