コード例 #1
0
        public void Should_Throw_If_TestCaseSummary_Is_Null()
        {
            var transformer = new EmmaXmlTransformer(GetFileSystemWrapper());

            Exception ex = Record.Exception(() => transformer.Transform(null));

            Assert.IsType<ArgumentNullException>(ex);
        }
コード例 #2
0
        public void Should_Generate_Xml()
        {
            var transformer = new EmmaXmlTransformer(GetFileSystemWrapper());
            var summary = GetTestCaseSummary();
            var expected =
@"<?xml version=""1.0"" encoding=""UTF-8"" ?>
<report>
 <stats>
  <srcfiles value=""3"" />
  <srclines value=""7"" />
 </stats>
 <data>
  <all name=""all classes"">
   <coverage type=""line, %"" value=""86% (6/7)"" />
   <srcfile name=""/three/lines/two/covered"">
    <coverage type=""line, %"" value=""67% (2/3)"" />
   </srcfile>
   <srcfile name=""/four/lines/four/covered"">
    <coverage type=""line, %"" value=""100% (4/4)"" />
   </srcfile>
  </all>
 </data>
</report>
";

            var result = transformer.Transform(summary);

            Assert.Equal(expected.Replace("\r", "").Replace("\n",""), result.Replace("\r", "").Replace("\n", ""));
        }