title: how do you mock an xml for unit testing?
body: <p>I need to unit testing this GetData method.</p>
  
  <pre><code>    public MessageResponse GetData(XmlElement requestElement)
      {   
          MessageResponse MsgResponse = new MessageResponse();
  
  
          if (requestElement.Attributes["employeeNo"] == null){
              MsgResponse.Messages = new List&lt;string&gt;();
              MsgResponse.Messages.Add("Attribute employeeNo is missing");
              MsgResponse.Error = true;
              return MsgResponse;
          }
          if (requestElement.Attributes["xmlEmployeeName"] == null){
              MsgResponse.Messages.Add("Attribute xmlEmployeeName is missing");
              MsgResponse.Error = true;
              return MsgResponse;
          }
          return MsgResponse;
      }
  </code></pre>
  
  <p>this method needs a XmlElement parameter. how do I mock it? in my code, I first created a xmlDocument, then load the xml file.</p>
  
  <pre><code>            XmlDocument doc = new XmlDocument();
              doc.Load(xmlFilePath);
              requestElement = doc.DocumentElement;
  </code></pre>
  
  <p>for me to test it, first i need to create a xml file without  employeeNo, the create antoher one without name, maybe alot more for other scenarios. it just seems like alot work.  is there a better way to test it?</p>
  
  <p>should I use moq or other testing framework to simplify the testing?</p>