public void EntityMissing_ThrowsErrorOnLoad()
        {
            const string exampleKey = "WhoopsImDead";

            _service.GetEntitiesResult.Add(exampleKey, null);

            var writeMemoryStream = new MemoryStream();

            PersistenceFunctions.SaveData(writeMemoryStream, _service);

            _service.GetEntitiesResult.Remove(exampleKey);
            LogAssert.Expect(LogType.Error, "Failed to find entry for key " + exampleKey);

            var readMemoryStream = new MemoryStream(writeMemoryStream.ToArray());

            PersistenceFunctions.LoadData(readMemoryStream, _service);
        }
        public void LoadData_EntityWasNull_NowRecognisedAsDestroyed()
        {
            const string exampleKey    = "WhoopsImDead";
            var          exampleEntity = new GameObject().AddComponent <MockPersistentEntityComponent>();

            _service.GetEntitiesResult.Add(exampleKey, null);

            var writeMemoryStream = new MemoryStream();

            PersistenceFunctions.SaveData(writeMemoryStream, _service);

            _service.GetEntitiesResult[exampleKey] = exampleEntity;
            var readMemoryStream = new MemoryStream(writeMemoryStream.ToArray());

            PersistenceFunctions.LoadData(readMemoryStream, _service);

            Assert.IsTrue(exampleEntity.PreviouslyDestroyedResult);
        }
        public void LoadData_DictionaryLoadedAsExpected()
        {
            var writeMemoryStream = new MemoryStream();

            PersistenceFunctions.SaveData(writeMemoryStream, _service);
            var readMemoryStream = new MemoryStream(writeMemoryStream.ToArray());

            PersistenceFunctions.LoadData(readMemoryStream, _service);

            foreach (var entity in _service.GetEntitiesResult)
            {
                if (entity.Value != null)
                {
                    var mockEntity = (MockPersistentEntityComponent)entity.Value;
                    Assert.AreSame(mockEntity.ReadDataStream, readMemoryStream);
                    Assert.IsFalse(mockEntity.PreviouslyDestroyedResult);
                }
            }
        }