Ho il sotto TestMethod
che sto testando con VS 2013 e sto usando Microsoft Fakes.Come smantellare XMLDocument in VS 2013 usando Microsoft Fakes
[TestMethod]
public void ConstructorTestForCMAClass()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<add name=\"console\" type=\"System.Diagnostics.DefaultTraceCMA\" value=\"Error\"/>");
XmlAttributeCollection attrColl = doc.DocumentElement.Attributes;
CMATracer cMATracer = new CMATracer(attrColl);
}
Per quanto sopra TestMethod
Se devo usare Stub, come dovrebbe essere modfied e volontà che sia una buona pratica di utilizzare lo stub al posto di XMLDocument
?
Ho provato questo ma non sono sicuro se questo è sufficiente o meno.
StubXmlDocument stubXmlDocument = new StubXmlDocument();
stubXmlDocument.LoadXml("<add name=\"console\" type=\"System.Diagnostics.DefaultTraceCMA\" value=\"Error\"/>");
//create a stub attribute collection
XmlAttributeCollection attrCollection = stubXmlDocument.DocumentElement.Attributes;
CMATracer cMATracer = new CMATracer(attrColl);
Sembra che la classe sottoposta a test (CMATracer) utilizzi XmlAttributeCollection in modo da essere deriso dalla cosa sbagliata. per favore aggiungi l'implementazione C'tor di CMATracer. –