public void disposing_is_safe()
        {
            var consumer = new TransactionFileConsumer<Message>("disposing_transaction_file_consumer_is_safe");
            consumer.Dispose();

            Assert.IsNull(consumer.Writer);
        }
        public void total_messages_value_is_valid()
        {
            const string filename = "total_messages_value_is_valid";
            if(File.Exists(filename))
            {
                File.Delete(filename);
                File.Delete(filename + ".write.chk");
                File.Delete(filename + "_checksum.read.chk");
            }

            // This consumer handles messages by writing them to disk
            var consumer = new TransactionFileConsumer<Message>(filename);
            consumer.Handle(new FakeMessage());
            consumer.Handle(new FakeMessage());

            // This producer reads messages written to disk and instruments the results
            var producer = new InstrumentedTransactionFileProducer<Message>(filename, Checksum);
            producer.AttachConsumer(consumer);

            Assert.AreEqual(2, Instrument.TotalMessages);
        }