//
// Copyright 2021–2022 alterNERDtive.
//
// This file is part of EDNA.
//
// EDNA is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// EDNA is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with EDNA. If not, see <https://www.gnu.org/licenses/>.
//
#pragma warning disable SA1615 // Element return value should be documented
#pragma warning disable SA1201 // Elements should appear in the correct order
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using alterNERDtive.Edna.Edts;
using Xunit;
namespace Test.Edts
{
///
/// Tests getting the correct location data from the EDTS API.
///
public class LocationTest
{
///
/// Pulls data from the EDTS API for known-good systems. This should not
/// throw an exception.
///
/// The system name.
[Theory]
[InlineData("Oevasy SG-Y d0")]
[InlineData("Oevasy AB-C d1-2")]
public async Task ProcGen_Valid(string name)
{
StarSystem system = await EdtsApi.FindSystem(name: name);
Assert.Equal(expected: name, actual: system.Name);
}
///
/// Pulls data from the EDTS API for known-bad systems. This should
/// throw an ArgumentException.
///
/// The system name.
[Theory]
[InlineData("Ysaveo YG-S d0")]
[InlineData("Oevasy SG-Y")]
[InlineData("Oevasy SG-Y d")]
[InlineData("Oevasy SG-Y 0")]
public async Task ProcGen_Invalid(string name)
{
ArgumentException e = await Assert.ThrowsAsync(() => EdtsApi.FindSystem(name: name));
Assert.Equal(expected: "name", actual: e.ParamName);
}
///
/// Pulls some systems from the EDTS API and checks if they still have
/// the previously known coordinates.
///
/// The expected system/coordinates.
[Theory]
[MemberData(nameof(Systems))]
public async Task ProcGen_Coordinates(StarSystem testSystem)
{
StarSystem system = await EdtsApi.FindSystem(name: testSystem.Name);
Assert.Equal(expected: testSystem.Position.X, actual: system.Position.X);
Assert.Equal(expected: testSystem.Position.Y, actual: system.Position.Y);
Assert.Equal(expected: testSystem.Position.Z, actual: system.Position.Z);
Assert.Equal(expected: testSystem.Uncertainty, actual: system.Uncertainty);
}
///
/// Gets a list of systems and known coordinates for the ProcGen_Coordinates test.
///
public static IEnumerable