public void Hibernate_CronosInstanceWithFollowersAndKnowledge_FileWritten() { //ARRANGE OmniscienceFileController controller = new OmniscienceFileController(); Cronos.Instance.FileController = controller; Cronos.Instance.DeactivateMemoryBackups(); if (controller.FileExists()) { controller.DeleteFile(); } var referenceData = MemoryContentInitializer.CreateItemsAndLinkThem(new ItemLinkFactory()); for (int i = 0; i < 50; i++) { Person newPerson = new Person("NPC" + i, Gender.Agender, Sex.Undefined, Orientation.Asexual, Guid.Empty); var newNpc = new global::RNPC.Core.Character(newPerson, Archetype.None); foreach (var data in referenceData) { if (RandomValueGenerator.GeneratePercentileIntegerValue() < 34) { newNpc.AddContentToLongTermMemory(data); } } Cronos.Instance.AddFollower(newNpc); } Cronos.Instance.AddReferenceDataList(referenceData); //ACT Cronos.Instance.Hibernate(); //ASSERT Assert.IsTrue(controller.FileExists()); }
public void ReadFromFile_OmniscienceFile_FileRead() { //ARRANGE OmniscienceFileController controller = new OmniscienceFileController(); if (!controller.FileExists()) { Assert.Fail(); } //ACT var omniscience = controller.ReadFromFile(); //ASSERT Assert.IsNotNull(omniscience); Assert.IsTrue(omniscience.MyFollowers.Count == 50); }
public void WakeUp_CronosInstanceWithFollowersAndKnowledge_FileRead() { //ARRANGE //string path = Directory.GetCurrentDirectory(); var controller = new OmniscienceFileController(); Cronos.Instance.FileController = controller; if (!controller.FileExists()) { Assert.Fail(); } //ConfigurationDirectory.Instance.KnowledgeFilesDirectory = Directory.GetCurrentDirectory(); //ACT Cronos.Instance.WakeUp(); //ASSERT Assert.IsTrue(Cronos.Instance.GetAllKnowledge().MyFollowers.Count != 0); }
public void WriteToFile_OmniscienceFile_FileWritten() { //ARRANGE OmniscienceFileController controller = new OmniscienceFileController(); if (controller.FileExists()) { controller.DeleteFile(); } var referenceData = MemoryContentInitializer.CreateItemsAndLinkThem(new ItemLinkFactory()); Dictionary <Guid, MemoryItem> dataDictionary = new Dictionary <Guid, MemoryItem>(); foreach (var item in referenceData) { dataDictionary.Add(Guid.NewGuid(), item); } Omniscience allKnowledge = new Omniscience(dataDictionary); for (int i = 0; i < 50; i++) { Person newPerson = new Person("NPC" + i, Gender.Agender, Sex.Undefined, Orientation.Asexual, Guid.Empty); var newNpc = new global::RNPC.Core.Character(newPerson, Archetype.None); for (int j = 0; j < referenceData.Count; j++) { if (RandomValueGenerator.GeneratePercentileIntegerValue() < 34) { newNpc.AddContentToLongTermMemory(dataDictionary.ElementAt(j).Value); } } allKnowledge.AddFollower(newNpc); } //ACT controller.WriteToFile(allKnowledge); //ASSERT controller.FileExists(); }
public void New_ConstructorCallWithEmptyPath_ExceptionRaised() { //ARRANGE //ACT OmniscienceFileController controller = new OmniscienceFileController(); }