/// <summary>
        ///   Saves the counter example to the <paramref name="file" />.
        /// </summary>
        /// <param name="file">The file the counter example should be saved to.</param>
        public virtual void Save(CounterExample <TExecutableModel> counterExample, string file)
        {
            Requires.NotNullOrWhitespace(file, nameof(file));

            if (!file.EndsWith(FileExtension))
            {
                file += FileExtension;
            }

            var directory = Path.GetDirectoryName(file);

            if (!String.IsNullOrWhiteSpace(directory))
            {
                Directory.CreateDirectory(directory);
            }

            using (var writer = new BinaryWriter(File.OpenWrite(file), Encoding.UTF8))
            {
                writer.Write(FileHeader);
                writer.Write(counterExample.EndsWithException);
                writer.Write(counterExample.RuntimeModel.SerializedModel.Length);
                writer.Write(counterExample.RuntimeModel.SerializedModel);

                foreach (var fault in counterExample.RuntimeModel.Faults)
                {
                    writer.Write((int)fault.Activation);
                }

                WriteInternalStateStructure(counterExample, writer);

                writer.Write(counterExample.StepCount + 1);
                writer.Write(counterExample.RuntimeModel.StateVectorSize);

                foreach (var slot in counterExample.States.SelectMany(step => step))
                {
                    writer.Write(slot);
                }

                writer.Write(counterExample.ReplayInfo.Length);
                foreach (var choices in counterExample.ReplayInfo)
                {
                    writer.Write(choices.Length);
                    foreach (var choice in choices)
                    {
                        writer.Write(choice);
                    }
                }
            }
        }
 public abstract void WriteInternalStateStructure(CounterExample <TExecutableModel> counterExample, BinaryWriter writer);
 /// <summary>
 ///   Initializes a new instance.
 /// </summary>
 public ExecutableCounterExample(TExecutableModel runtimeModel, CounterExample counterExample)
     : this(runtimeModel, counterExample.States, counterExample.ReplayInfo, counterExample.EndsWithException, counterExample.FaultActivations)
 {
 }