title: How to mock System.Xml.XmlWriter.WriteAttributeString() with moq?
body: <p>When I run the following code in my test,</p>
  
  <pre><code>Mock&lt;XmlWriter&gt; mockXmlWriter = new Mock&lt;System.Xml.XmlWriter&gt;();
  Language language = Language.GetLangauge(langId);
  language.WriteXml(mockXmlWriter.Object);
  mockXmlWriter.Verify(writer =&gt; writer.WriteAttributeString("ID", language.LanguageID.ToString()));
  </code></pre>
  
  <p>Moq understandably throws the following exception: <code>System.NotSupportedException : Invalid verify on a non-virtual (overridable in VB) member: writer =&gt; writer.WriteAttributeString("ID", .language.LanguageID.ToString())</code>.</p>
  
  <p>Stupid abstract <code>XmlWriter</code> still has some non-abstract, non-virtual methods, like <code>WriteAttributeString()</code> :(</p>
  
  <p>I looked for an <code>XmlWriterBase</code> or a <code>System.Xml.Abstractions</code>, like I do for <code>HttpContext</code> and Co., but found nothing :(</p>
  
  <p>How would I overcome this so I can test that my <code>WriteXml</code> method is doing what it's supposed to be doing?</p>