Beispiel #1
0
        public void CreateEncounterIsCreated(string encounterResRef)
        {
            Location    startLocation = NwModule.Instance.StartingLocation;
            NwEncounter?encounter     = NwEncounter.Create(encounterResRef, startLocation);

            Assert.That(encounter, Is.Not.Null, $"Encounter {encounterResRef} was null after creation.");
            Assert.That(encounter !.IsValid, Is.True, $"Encounter {encounterResRef} was invalid after creation.");

            createdTestObjects.Add(encounter);
        }
Beispiel #2
0
        public void DestroyEncounterIsDestroyed(string encounterResRef)
        {
            Location    startLocation = NwModule.Instance.StartingLocation;
            NwEncounter?encounter     = NwEncounter.Create(encounterResRef, startLocation);

            Assert.That(encounter, Is.Not.Null, $"Encounter {encounterResRef} was null after creation.");
            Assert.That(encounter !.IsValid, Is.True, $"Encounter {encounterResRef} was invalid after creation.");

            encounter.Destroy();
            Assert.That(encounter.IsValid, Is.False, $"Encounter {encounterResRef} was still valid after deletion.");
        }
Beispiel #3
0
        public void SerializeEncounterCreatesValidData(string encounterResRef)
        {
            Location    startLocation = NwModule.Instance.StartingLocation;
            NwEncounter?encounter     = NwEncounter.Create(encounterResRef, startLocation);

            Assert.That(encounter, Is.Not.Null, $"Encounter {encounterResRef} was null after creation.");
            Assert.That(encounter !.IsValid, Is.True, $"Encounter {encounterResRef} was invalid after creation.");

            createdTestObjects.Add(encounter);

            byte[]? encounterData = encounter.Serialize();

            Assert.That(encounterData, Is.Not.Null);
            Assert.That(encounterData, Has.Length.GreaterThan(0));

            NwEncounter?encounter2 = NwEncounter.Deserialize(encounterData !);

            Assert.That(encounter2, Is.Not.Null);
            Assert.That(encounter2 !.IsValid, Is.True);

            createdTestObjects.Add(encounter2);

            Assert.That(encounter2.Area, Is.Null);
        }