EDBGS/EDPlayerJournalTests/MissionTest.cs

38 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EDPlayerJournal.Entries;
namespace EDPlayerJournalTests;
[TestClass]
public class MissionTest {
[TestMethod]
public void TestMissionAccepted() {
string altruism = /*lang=json,strict*/ """{ "timestamp":"2022-11-23T08:05:54Z", "event":"MissionAccepted", "Faction":"HIP 6182 Federal Inc", "Name":"Mission_AltruismCredits", "LocalisedName":"Donate 1,000,000 Cr to the cause", "Donation":"1000000", "Expiry":"2022-11-23T11:50:52Z", "Wing":false, "Influence":"++", "Reputation":"++", "MissionID":901601358 }""";
Entry? entry = Entry.Parse(altruism);
Assert.IsNotNull(entry);
Assert.IsInstanceOfType(entry, typeof(MissionAcceptedEntry));
MissionAcceptedEntry? accepted = entry as MissionAcceptedEntry;
Assert.IsNotNull(accepted);
Assert.IsNotNull(accepted.Mission);
Assert.AreEqual(accepted.Mission.MissionID, (ulong)901601358);
Assert.AreEqual(accepted.Mission.Faction, "HIP 6182 Federal Inc");
Assert.AreEqual(accepted.Mission.Name, "Mission_AltruismCredits");
Assert.AreEqual(accepted.Mission.LocalisedName, "Donate 1,000,000 Cr to the cause");
Assert.AreEqual(accepted.Mission.Donation, (ulong)1000000);
Assert.AreEqual(accepted.Mission.Expiry, "2022-11-23T11:50:52Z");
Assert.AreEqual(accepted.Mission.Wing, false);
Assert.AreEqual(accepted.Mission.Reputation, "++");
Assert.AreEqual(accepted.Mission.Influence, "++");
}
}