NUnit FileAssert fails between MemoryStream and FileStream
===

I have a test class that tests two that a generated xml file matches one that is already generated and known to be good. The test passes when comparing files written to disk. It fails when comparing the file still in memory to the known good file read from the disk, because the expected stream is 17 bytes longer.

testing class

    [TestFixture]
    class XmlExporterTest
    {
        private const string ExpectedXMLFile = @"..\..\Projects\EXPECTED FILE.xml";

        private XmlExporter xmlExporter;

        [SetUp]
        public void SetUp()
        {
            // clean up from before, since we might want the info after the tests (if they fail for example)
            string[] filePaths = Directory.GetFiles(@"..\..\tmp");
            foreach (string f in filePaths)
            {
                File.Delete(f);
            }
        }

        // this always fails because the stream length is 17 bytes short
        [Test]
        public void TestExportToXMLStream()
        {
            // test write to stream
            using (Stream actualStream = xmlExporter.ExportToXML(true))
            {
                using (Stream expectedStream = new FileStream(ExpectedXMLFile, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None))
                {
                    FileAssert.AreEqual(expectedStream, actualStream);
                }
            }
        }

        // this always passes
        [Test]
        public void TestExportToXMLFile()
        {
            const string actualXMLFile = @"..\..\tmp\project1.xml";
            xmlExporter.ExportToXML(actualXMLFile, true);
            FileAssert.AreEqual(ExpectedXMLFile, actualXMLFile);
        }
    }

XML exporting class

    public class XmlExporter
    {
        public void ExportToXML(string filename, bool normalizeZoom)
        {
            iexINSPECTIONXPERT arr = CreateSerializableObject(normalizeZoom);

            //serialize to an XML file
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("xxx", "http://www.example.com");
            using (TextWriter tr2 = new StreamWriter(filename))
            {
                XmlSerializer sr2 = new XmlSerializer(typeof(Foo));
                sr2.Serialize(tr2, arr, ns);
            }
        }

        /// <summary>
        /// Exports to XML only returning a MemoryStream object.
        /// Note that the stream must be disposed of by the caller.
        /// </summary>
        /// <param name="normalizeZoom"></param>
        /// <returns></returns>
        public MemoryStream ExportToXML(bool normalizeZoom)
        {
            iexINSPECTIONXPERT arr = CreateSerializableObject(normalizeZoom);

            //serialize to an XML file
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("xxx", "http://www.example.com");
            var stream = new MemoryStream();
            XmlSerializer sr2 = new XmlSerializer(typeof(Foo));
            sr2.Serialize(stream, arr, ns);
            return stream;
        }
    }

other class

    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.example.com", ElementName = "Foo")]
    public class Foo
    {
        [XmlElementAttribute(Namespace = "", ElementName = "BAR")]
        public BAR fi;
    }
