예제 #1
0
        public void When_passing_removed_item_xml_should_contain_it()
        {
            IComparerResult result = new ComparerResult(ResultContext.Assembly, "Assembly");
              result.AddRemovedItem(ResultContext.Constructor, ".ctor", Severity.Warning);
              XElement xml = XmlGenerator.GenerateXml(result);
              XElement sut = xml.Element(ChangedElement).Element(RemovedElement);

              Assert.AreEqual(".ctor", sut.Attribute("Name").Value);
              StringAssert.AreEqualIgnoringCase(Severity.Warning.ToString(), sut.Attribute("Severity").Value);
              StringAssert.AreEqualIgnoringCase(ResultContext.Constructor.ToString(), sut.Attribute("Context").Value);
        }
예제 #2
0
        public void When_passing_changed_property_xml_should_contain_it()
        {
            IComparerResult result = new ComparerResult(ResultContext.Assembly, "Assembly");
              result.AddChangedProperty("PropName", "old", "new", Severity.Error);
              XElement xml = XmlGenerator.GenerateXml(result);
              XElement sut = xml.Element(ChangedElement).Element(ChangedAttribute);

              Assert.AreEqual("PropName", sut.Attribute("Name").Value);
              StringAssert.AreEqualIgnoringCase(Severity.Error.ToString(), sut.Attribute("Severity").Value);
              Assert.AreEqual("old", sut.Attribute("ReferenceValue").Value);
              Assert.AreEqual("new", sut.Attribute("NewValue").Value);
        }
예제 #3
0
        public void When_passing_changed_flag_xml_should_contain_it()
        {
            IComparerResult result = new ComparerResult(ResultContext.Assembly, "Assembly");
              result.AddChangedFlag("Flag", true, Severity.Hint);
              XElement xml = XmlGenerator.GenerateXml(result);
              XElement sut = xml.Element("ChangedElement").Element("ChangedAttribute");

              Assert.AreEqual("Flag", sut.Attribute("Name").Value);
              StringAssert.AreEqualIgnoringCase(Severity.Hint.ToString(), sut.Attribute("Severity").Value);
              StringAssert.AreEqualIgnoringCase(true.ToString(), sut.Attribute("ReferenceValue").Value);
              StringAssert.AreEqualIgnoringCase(false.ToString(), sut.Attribute("NewValue").Value);
        }
예제 #4
0
        public void When_passing_two_level_report_xml_should_contain_it()
        {
            IComparerResult result1 = new ComparerResult(ResultContext.Assembly, "Assembly");
              IComparerResult result2 = new ComparerResult(ResultContext.Class, "Class");
              result2.AddChangedFlag("dummy", true, Severity.Error);
              result1.AddComparerResult(result2);
              XElement sut = XmlGenerator.GenerateXml(result1);

              Assert.NotNull(sut.Element(ChangedElement).Element(ChangedElement));
        }
예제 #5
0
        public void When_passing_result_with_no_content_it_is_not_exported()
        {
            IComparerResult result = new ComparerResult(ResultContext.Assembly, "Assembly");
              XElement sut = XmlGenerator.GenerateXml(result);

              Assert.AreEqual(0, sut.Elements(ChangedElement).Count());
        }
예제 #6
0
 public Builder Result(ResultContext resultContext = ResultContext.Class, string name = null)
 {
     ComparerResult comparerResult = new ComparerResult(resultContext, name);
     _comparerResult.AddComparerResult(comparerResult);
     return new Builder(this, comparerResult);
 }
예제 #7
0
 private Builder(Builder parent, ComparerResult comparerComparerResult)
 {
     _parent = parent;
     _comparerResult = comparerComparerResult;
 }