public void CanRT_Compendium() { //var creator = new BeingCreator(__factory); var publisher = new BookPublisher(_creator); var tomeOfChaos = publisher.Tome_FromNew("gloop"); var herbal = new Herbal(); var socialRegister = new SocialRegister(_creator); var dramaticon = new Dramaticon(); var atlas = new Atlas(); var idGen = new IDGenerator(33); var compendium = new Compendium(idGen, _creator, tomeOfChaos, herbal, socialRegister, dramaticon, atlas); var yaml = _serializer.Serialize(compendium); Assert.That(yaml, Is.Not.Null); var newBook = _deserializer.Deserialize <IBook>(yaml); Assert.That(newBook, Is.TypeOf <Compendium>()); var newCompendium = (Compendium)newBook; Assert.That(newCompendium.IDGenerator.UseID(), Is.EqualTo(33)); Assert.That(newCompendium.TomeOfChaos.TopSeed, Is.EqualTo("gloop")); //TODO: slightly more muscular checks once these books go beyond placeholders Assert.That(newCompendium.Herbal, Is.Not.Null); Assert.That(newCompendium.SocialRegister, Is.Not.Null); Assert.That(newCompendium.Dramaticon, Is.Not.Null); Assert.That(newCompendium.Atlas, Is.Not.Null); }
public void MapSeeds_lead_to_different_values(string topSeed) { var tome_1 = _publisher.Tome_FromNew(topSeed + "a"); var tome_2 = _publisher.Tome_FromNew(topSeed + "b"); int next_tf_1 = tome_1.MapRndNext(MapEnum.TackerFarm); int next_tf_2 = tome_2.MapRndNext(MapEnum.TackerFarm); int next_tb_1 = tome_1.MapRndNext(MapEnum.TownBarricade); int next_tb_2 = tome_2.MapRndNext(MapEnum.TownBarricade); Assert.That(next_tb_1, Is.Not.EqualTo(next_tf_1)); Assert.That(next_tb_2, Is.Not.EqualTo(next_tf_2)); }
public void CanRT_TomeOfChaos() { var publisher = new BookPublisher(_creator); var tome = publisher.Tome_FromNew("floop"); var yaml = _serializer.Serialize(tome); Assert.That(yaml, Is.Not.Null); var newBook = _deserializer.Deserialize <IBook>(yaml); Assert.That(newBook, Is.TypeOf <TomeOfChaos>()); var newTome = (TomeOfChaos)newBook; Assert.That(newTome.TopSeed, Is.EqualTo("floop")); Assert.That(newTome.Generators["Top"], Is.TypeOf <NR3Generator>()); Assert.That(newTome.Generators["Learnable"], Is.TypeOf <NR3Generator>()); Assert.That(newTome.Generators["MapTop"], Is.TypeOf <NR3Generator>()); for (int i = 0; i < 10; i++) { Assert.That(newTome.LearnableRndNext(), Is.EqualTo(tome.LearnableRndNext()), "The numbers emitted from a serialized & deserialized RNG should match the RNG it was originally serialized from."); } }