private TotalTestsProperties LoadTotalTestsProperties() { var total = doc.Element(XName.Get("TestRun", xmlns)).Element(XName.Get("ResultSummary", xmlns)).Element(XName.Get("Counters", xmlns)); var startTime = doc.Element(XName.Get("TestRun", xmlns)).Element(XName.Get("Times", xmlns)).Attribute("start"); var finishTime = doc.Element(XName.Get("TestRun", xmlns)).Element(XName.Get("Times", xmlns)).Attribute("finish"); XAttribute testCategory; if ( doc.Element(XName.Get("TestRun", xmlns)) .Element(XName.Get("TestDefinitions", xmlns)) .Element(XName.Get("UnitTest", xmlns)) .Element(XName.Get("TestCategory", xmlns)) != null) { testCategory = doc.Element(XName.Get("TestRun", xmlns)) .Element(XName.Get("TestDefinitions", xmlns)) .Element(XName.Get("UnitTest", xmlns)) .Element(XName.Get("TestCategory", xmlns)) .Element(XName.Get("TestCategoryItem", xmlns)) .Attribute("TestCategory"); } else { testCategory = doc.Element(XName.Get("TestRun", xmlns)).Attribute("name"); } var prop = new TotalTestsProperties() { Total = total.Attribute("total").Value.ToString(), Executed = total.Attribute("executed").Value.ToString(), Passed = total.Attribute("passed").Value.ToString(), Failed = total.Attribute("failed").Value.ToString(), Error = total.Attribute("error").Value.ToString(), Timeout = total.Attribute("timeout").Value.ToString(), Aborted = total.Attribute("aborted").Value.ToString(), Inconclusive = total.Attribute("inconclusive").Value.ToString(), PassedButRunAborted = total.Attribute("passedButRunAborted").Value.ToString(), NotRunnable = total.Attribute("notRunnable").Value.ToString(), NotExecuted = total.Attribute("notExecuted").Value.ToString(), Disconnected = total.Attribute("disconnected").Value.ToString(), Warning = total.Attribute("warning").Value.ToString(), Completed = total.Attribute("completed").Value.ToString(), InProgress = total.Attribute("inProgress").Value.ToString(), Pending = total.Attribute("pending").Value.ToString(), StartTime = DateTime.Parse(startTime.Value.ToString()), FinishTime = DateTime.Parse(finishTime.Value.ToString()), TestCategory = testCategory.Value.ToString() }; prop.Duration = prop.FinishTime.Subtract(prop.StartTime); return(prop); }
public override bool Equals(object obj) { if (!(obj is TotalTestsProperties)) { return(false); } TotalTestsProperties o = (TotalTestsProperties)obj; return(Total == o.Total && Executed == o.Executed && Passed == o.Passed && Failed == o.Failed && Error == o.Error && Timeout == o.Timeout && Aborted == o.Aborted && Inconclusive == o.Inconclusive && PassedButRunAborted == o.PassedButRunAborted && NotRunnable == o.NotRunnable && NotExecuted == o.NotExecuted && Disconnected == o.Disconnected && Warning == o.Warning && Completed == o.Completed && InProgress == o.InProgress && Pending == o.Pending && StartTime == o.StartTime && FinishTime == o.FinishTime && InProgress == o.InProgress && TestCategory == o.TestCategory); }