Пример #1
0
        public void GenerateNoResults()
        {
            // arrange
            var writer = new MemoryFileWriter ();
            const string filePath = "<memory>";
            var report = new XmlReport (writer, filePath);

            // act
            report.Generate (new MetricResult[] { });

            // assert
            Assert.AreEqual ("<metrics />", writer.Contents);
            Assert.AreEqual (filePath, writer.FilePath);
        }
Пример #2
0
 public void GenerateSampleMetricResult()
 {
     var instance = new XmlReport (new MemoryFileWriter (), null);
     var sampleMetricResult = new MetricResultBuilder ().CreateMetricResult ();
     instance.Generate (sampleMetricResult);
     AssertAreEqual (@"
     <metrics>
     <metric name=""Test Metric"">
     <class name=""Test Class 1"">
     <method name=""Test Method1"" pass=""false"" result=""12"" />
     <method name=""Test Method2"" pass=""true"" result=""5"" />
     </class>
     <class name=""Test Class 1"">
     <method name=""Test Method1"" pass=""false"" result=""12"" />
     <method name=""Test Method2"" pass=""true"" result=""5"" />
     </class>
     </metric>
     </metrics>", instance);
 }
Пример #3
0
 private static void AssertAreEqual(string expectedXml, XmlReport actualReport)
 {
     var expectedElement = XElement.Parse (expectedXml);
     Assert.AreEqual (expectedElement.ToString (), actualReport.ToString ());
 }
Пример #4
0
 public void EmptyReport()
 {
     var report = new XmlReport (null, null);
     AssertAreEqual ("<metrics />", report);
 }