public void RoundTripEmptyState() { SystemState systemState = new(); systemState.SerializeCache(_rarCacheFile, _taskLoggingHelper); var deserialized = SystemState.DeserializeCache(_rarCacheFile, _taskLoggingHelper, typeof(SystemState)); deserialized.ShouldNotBeNull(); }
public void WrongFileVersion() { SystemState systemState = new(); systemState.SerializeCache(_rarCacheFile, _taskLoggingHelper); using (var cacheStream = new FileStream(_rarCacheFile, FileMode.Open, FileAccess.ReadWrite)) { cacheStream.Seek(0, SeekOrigin.Begin); cacheStream.WriteByte(StateFileBase.CurrentSerializationVersion - 1); cacheStream.Close(); } var deserialized = SystemState.DeserializeCache(_rarCacheFile, _taskLoggingHelper, typeof(SystemState)); deserialized.ShouldBeNull(); }