public void EquatorialCoordinates_Success(DateTime date, string planetName, Vector2 <decimal> expected, decimal epsilon = 0.05m) { // arrange & act var actual = PlanetManager.GetInstance() .GetPlanet(planetName) .EquatorialCoordinates(date); // assert Assert.True(Vector2 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}"); }
public void EclipticSun3D_Success(DateTime date, string planetName, Vector3 <decimal> expected, decimal epsilon = 0.001m) { //arrange var planet = PlanetManager.GetInstance().GetPlanet(planetName); // act var actual = planet.EclipticSun3D(date); // assert Assert.True(Vector3 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}, distance: {Vector3<decimal>.Distance(actual, expected)}"); }
public void ApparentEclipticEarth_Success(DateTime date, string planetName, Vector2 <decimal> expected, decimal epsilon = 0.1m) { // arrange var planet = PlanetManager.GetInstance().GetPlanet(planetName); // act var actual = planet.ApparentEclipticEarth(date); // assert Assert.True(Vector2 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}"); }
public void EclipticSun3D_Success(DateTime date, Vector3 <decimal> expected) { // arrange var earth = PlanetManager.GetInstance().GetPlanet("Earth"); // act var actual = earth.EclipticSun3D(date); //assert Assert.True(Vector3 <decimal> .IsClose(actual, expected, 0.001m), $"actual: {actual}, expected: {expected}, distance: {Vector3<decimal>.Distance(actual, expected)}"); }
public void OrbitalElemets_Success(DateTime date, string planetName, OrbitalElements expected) { var epsilon = 2m; // arrange & act var actual = PlanetManager.GetInstance().GetPlanet(planetName).GetOrbitalElements(date); // assert string output = string.Empty; output += !DecimalMath.IsClose(actual.LongAscedingNode, expected.LongAscedingNode, epsilon) ? $"\nLongAscendingNode\texpected : {expected.LongAscedingNode} actual {actual.LongAscedingNode}" : string.Empty; output += !DecimalMath.IsClose(actual.Inclination, expected.Inclination, epsilon) ? $"\nInclination\t\texpected : {expected.Inclination} actual {actual.Inclination}" : string.Empty; output += !DecimalMath.IsClose(actual.Peryhelion, expected.Peryhelion, epsilon) ? $"\nPeryhelion\t\texpected : {expected.Peryhelion} actual {actual.Peryhelion}" : string.Empty; output += !DecimalMath.IsClose(actual.Eccentricity, expected.Eccentricity, epsilon) ? $"\nEccentricity\t\texpected : {expected.Eccentricity} actual {actual.Eccentricity}" : string.Empty; output += !DecimalMath.IsClose(actual.MeanAnomaly, expected.MeanAnomaly, epsilon) ? $"\nMeanAnomaly\t\texpected : {expected.MeanAnomaly} actual {actual.MeanAnomaly}" : string.Empty; output += !DecimalMath.IsClose(actual.SemimajorAxis, expected.SemimajorAxis, epsilon) ? $"\nSemimajorAxis\t\texpected : {expected.SemimajorAxis} actual {actual.SemimajorAxis}" : string.Empty; Assert.True(string.IsNullOrEmpty(output), output); }
public void ApparentEclipticEarth_PlanetIsSun_Fail() { Assert.Throws <NotImplementedException>(() => PlanetManager.GetInstance().GetPlanet("Sun").ApparentEclipticEarth(DateTime.Now)); }
public void GetPlanet_PlanetIsEarth_Success() { var earth = PlanetManager.GetInstance().GetPlanet("Earth"); Assert.Same(earth, EarthPosition.EarthInstance); }
public void GetPlanet_PlanetNotCelestialPosition_Fail() { Assert.Throws <InvalidCastException>(() => PlanetManager.GetInstance().GetPlanet("Rahu")); }