本文整理汇总了C#中MonoDevelop.NUnit.UnitTestResult类的典型用法代码示例。如果您正苦于以下问题:C# UnitTestResult类的具体用法?C# UnitTestResult怎么用?C# UnitTestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitTestResult类属于MonoDevelop.NUnit命名空间,在下文中一共展示了UnitTestResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateIgnored
public static UnitTestResult CreateIgnored (string message)
{
UnitTestResult res = new UnitTestResult ();
res.status = ResultStatus.Ignored;
res.Message = message;
return res;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:UnitTestResult.cs
示例2: RegisterResult
public void RegisterResult (string configuration, UnitTest test, UnitTestResult result)
{
string aname = test.StoreRelativeName;
TestRecord root = GetRootRecord (configuration, result.TestDate);
if (root == null) {
root = new TestRecord ();
fileCache [GetRootFileName (configuration, result.TestDate)] = root;
}
root.Modified = true;
TestRecord record = root;
if (aname.Length > 0) {
string[] path = test.StoreRelativeName.Split ('.');
foreach (string p in path) {
TestRecord ctr = record.Tests != null ? record.Tests [p] : null;
if (ctr == null) {
ctr = new TestRecord ();
ctr.Name = p;
if (record.Tests == null)
record.Tests = new TestRecordCollection ();
record.Tests.Add (ctr);
}
record = ctr;
}
}
if (record.Results == null)
record.Results = new UnitTestResultCollection ();
record.Results.Add (result);
}
开发者ID:hippiehunter,项目名称:monodevelop,代码行数:31,代码来源:AbstractResultsStore.cs
示例3: XUnitExecutionSession
public XUnitExecutionSession (UnitTest unitTest, bool reportToMonitor)
{
this.reportToMonitor = reportToMonitor;
this.unitTest = unitTest;
result = new UnitTestResult ();
childSessions = new List<XUnitExecutionSession> ();
}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:7,代码来源:XUnitExecutionSession.cs
示例4: CreateInconclusive
public static UnitTestResult CreateInconclusive (string message)
{
UnitTestResult res = new UnitTestResult ();
res.status = ResultStatus.Inconclusive;
res.Message = message;
return res;
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:UnitTestResult.cs
示例5: CreateFailure
public static UnitTestResult CreateFailure (string message, Exception ex)
{
UnitTestResult res = new UnitTestResult ();
res.status = ResultStatus.Failure;
res.Message = message;
res.stackTrace = ex.Message + "\n" + ex.StackTrace;
return res;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:8,代码来源:UnitTestResult.cs
示例6: ResultRecord
void ITestProgressMonitor.EndTest(UnitTest test, UnitTestResult result)
{
if (test is UnitTestGroup)
return;
testsRun++;
ResultRecord rec = new ResultRecord ();
rec.Test = test;
rec.Result = result;
if (result.IsFailure) {
testsFailed++;
}
if (result.IsIgnored) {
testsIgnored++;
}
results.Add (rec);
ShowTestResult (test, result);
UpdateCounters ();
progressBar.Fraction = ((double)testsRun / (double)testsToRun);
progressBar.Text = testsRun + " / " + testsToRun;
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:24,代码来源:TestResultsPad.cs
示例7: EndTest
public void EndTest (UnitTest test, UnitTestResult result)
{
Runtime.RunInMainThread (delegate {
monitor.EndTest (test, result);
});
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:6,代码来源:TestResultsPad.cs
示例8: CountResults
int CountResults (UnitTestResult result)
{
int count = 0;
count += result.Passed;
count += result.Errors;
count += result.Failures;
count += result.Ignored;
count += result.Inconclusive;
count += result.Skipped;
return count;
}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:11,代码来源:XUnitTestCase.cs
示例9: Add
public void Add (UnitTestResult test)
{
((IList)this).Add (test);
}
开发者ID:hippiehunter,项目名称:monodevelop,代码行数:4,代码来源:AbstractResultsStore.cs
示例10: ReportXmlResult
UnitTestResult ReportXmlResult (IRemoteEventListener listener, XElement elem, string testPrefix, bool macunitStyle)
{
UnitTestResult result = new UnitTestResult ();
var time = (string)elem.Attribute ("time");
if (time != null)
result.Time = TimeSpan.FromSeconds (double.Parse (time, CultureInfo.InvariantCulture));
result.TestDate = DateTime.Now;
var reason = elem.Element ("reason");
if (reason != null)
result.Message = (string) reason;
var failure = elem.Element ("failure");
if (failure != null) {
var msg = failure.Element ("message");
if (msg != null)
result.Message = (string)msg;
var stack = failure.Element ("stack-trace");
if (stack != null)
result.StackTrace = (string)stack;
}
switch ((string)elem.Attribute ("result")) {
case "Error":
case "Failure":
result.Status = ResultStatus.Failure;
break;
case "Success":
result.Status = ResultStatus.Success;
break;
case "Ignored":
result.Status = ResultStatus.Ignored;
break;
default:
result.Status = ResultStatus.Inconclusive;
break;
}
if (elem.Name == "test-suite") {
// nunitlite does not emit <test-suite type="Namespace" elements so we need to fake
// them by deconstructing the full type name and emitting the suite started events manually
var names = new List<string> ();
if (!macunitStyle || (string)elem.Attribute ("type") == "Assembly")
names.Add ("<root>");
else
names.AddRange (elem.Attribute ("name").Value.Split ('.'));
for (int i = 0; i < names.Count; i ++)
listener.SuiteStarted (testPrefix + string.Join (".", names.Take (i + 1)));
var name = (string)elem.Attribute ("type") == "Assembly" ? "<root>" : (string) elem.Attribute ("name");
var cts = elem.Element ("results");
if (cts != null) {
foreach (var ct in cts.Elements ()) {
var r = ReportXmlResult (listener, ct, name != "<root>" ? testPrefix + name + "." : "", macunitStyle);
result.Add (r);
}
}
for (int i = 0; i < names.Count; i ++)
listener.SuiteFinished (testPrefix + string.Join (".", names.Take (i + 1)), result);
} else {
string name = (string)elem.Attribute ("name");
switch (result.Status) {
case ResultStatus.Success:
result.Passed++;
break;
case ResultStatus.Failure:
result.Failures++;
break;
case ResultStatus.Ignored:
result.Ignored++;
break;
case ResultStatus.Inconclusive:
result.Inconclusive++;
break;
}
listener.TestStarted (name);
listener.TestFinished (name, result);
}
return result;
}
开发者ID:riverans,项目名称:monodevelop,代码行数:82,代码来源:NUnitAssemblyTestSuite.cs
示例11: EndTest
public void EndTest (UnitTest test, UnitTestResult result)
{
DispatchService.GuiDispatch (delegate {
monitor.EndTest (test, result);
});
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:6,代码来源:TestResultsPad.cs
示例12: OnFailed
public void OnFailed (TestContext context, string id, decimal executionTime, string output, string[] exceptionTypes, string[] messages, string[] stackTraces)
{
UnitTestResult result = session.Result;
VirtualTest test = null;
int count = CountResults (session.Result);
if (count > 0) {
if (count < 2) {
test = new VirtualTest (this, count);
result = CopyResult (session.Result);
session.Context.Monitor.BeginTest (test);
session.Context.Monitor.EndTest (test, result);
test.RegisterResult (session.Context, result);
session.Result.Add (result);
count++;
}
test = new VirtualTest (this, count);
result = new UnitTestResult ();
}
result.Status = ResultStatus.Failure;
result.Failures = 1;
result.Time = TimeSpan.FromSeconds (Decimal.ToDouble (executionTime));
result.ConsoleOutput = output;
if (messages.Length > 0)
result.Message = messages [0];
if (stackTraces.Length > 0)
result.StackTrace = stackTraces [0];
if (test != null) {
session.Context.Monitor.BeginTest (test);
session.Context.Monitor.EndTest (test, result);
test.RegisterResult (session.Context, result);
session.Result.Add (result);
}
}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:44,代码来源:XUnitTestCase.cs
示例13: OnTestSuiteChanged
public void OnTestSuiteChanged (object sender, EventArgs e)
{
if (failuresTreeView.IsRealized)
failuresTreeView.ScrollToPoint (0, 0);
results.Clear ();
error = null;
errorMessage = null;
failuresStore.Clear ();
outputView.Buffer.Clear ();
outIters.Clear ();
progressBar.Fraction = 0;
progressBar.Text = "";
testsRun = 0;
resultSummary = new UnitTestResult ();
UpdateCounters ();
if (rootTest != null) {
rootTest = testService.SearchTest (rootTest.FullName);
if (rootTest == null)
buttonRun.Sensitive = false;
}
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:24,代码来源:TestResultsPad.cs
示例14: Add
public void Add (UnitTestResult res)
{
Time += res.Time;
Passed += res.Passed;
Errors += res.Errors;
Failures += res.Failures;
Ignored += res.Ignored;
Inconclusive += res.Inconclusive;
Skipped += res.Skipped;
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:UnitTestResult.cs
示例15: OnRun
protected override UnitTestResult OnRun (TestContext testContext)
{
UnitTestResult tres = new UnitTestResult ();
OnBeginTest (testContext);
try {
foreach (UnitTest t in Tests) {
if (t.IsExplicit)
continue;
UnitTestResult res;
try {
res = OnRunChildTest (t, testContext);
if (testContext.Monitor.IsCancelRequested)
break;
} catch (Exception ex) {
res = UnitTestResult.CreateFailure (ex);
}
tres.Add (res);
}
} finally {
OnEndTest (testContext);
}
return tres;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:24,代码来源:UnitTestGroup.cs
示例16: GetLastResult
public UnitTestResult GetLastResult ()
{
if (!resultLoaded) {
resultLoaded = true;
lastResult = Results.GetLastResult (DateTime.Now);
if (lastResult != null)
historicResult = true;
}
return lastResult;
}
开发者ID:riverans,项目名称:monodevelop,代码行数:10,代码来源:UnitTest.cs
示例17: ShowTestResult
void ShowTestResult(UnitTest test, UnitTestResult result)
{
if (result.IsSuccess) {
if (!buttonSuccess.Active)
return;
TreeIter testRow = failuresStore.AppendValues (CircleImage.Success, Escape (test.FullName), test);
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.IsFailure) {
if (!buttonFailures.Active)
return;
TreeIter testRow = failuresStore.AppendValues (CircleImage.Failure, Escape (test.FullName), test);
bool hasMessage = result.Message != null && result.Message.Length > 0;
if (hasMessage)
failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
if (result.StackTrace != null && result.StackTrace.Length > 0) {
TreeIter row = testRow;
if (hasMessage)
row = failuresStore.AppendValues (testRow, null, "Stack Trace", test);
failuresStore.AppendValues (row, null, Escape (result.StackTrace), test);
}
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.IsIgnored) {
if (!buttonIgnored.Active)
return;
TreeIter testRow = failuresStore.AppendValues (CircleImage.NotRun, Escape (test.FullName), test);
failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.ConsoleOutput != null)
outputView.Buffer.InsertAtCursor (result.ConsoleOutput);
if (result.ConsoleError != null)
outputView.Buffer.InsertAtCursor (result.ConsoleError);
outputView.ScrollMarkOnscreen (outputView.Buffer.InsertMark);
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:36,代码来源:TestResultsPad.cs
示例18: ShowTestResult
void ShowTestResult (UnitTest test, UnitTestResult result)
{
if (result.IsSuccess) {
if (!buttonSuccess.Active)
return;
TreeIter testRow = failuresStore.AppendValues (TestStatusIcon.Success, Escape (test.FullName), test);
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.IsFailure) {
if (!buttonFailures.Active)
return;
string file = test.SourceCodeLocation != null ? test.SourceCodeLocation.FileName + ":" + test.SourceCodeLocation.Line : null;
TreeIter testRow = failuresStore.AppendValues (TestStatusIcon.Failure, Escape (test.FullName), test, file);
bool hasMessage = result.Message != null && result.Message.Length > 0;
if (hasMessage)
failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
if (result.StackTrace != null && result.StackTrace.Length > 0) {
TreeIter row = testRow;
if (hasMessage)
row = failuresStore.AppendValues (testRow, null, GettextCatalog.GetString ("Stack Trace"), test);
AddStackTrace (row, result.StackTrace, test);
}
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.IsNotRun) {
if (!buttonIgnored.Active)
return;
TreeIter testRow = failuresStore.AppendValues (TestStatusIcon.NotRun, Escape (test.FullName), test);
if (result.Message != null)
failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
if (result.IsInconclusive) {
if (!buttonInconclusive.Active)
return;
TreeIter testRow = failuresStore.AppendValues (TestStatusIcon.Inconclusive, Escape (test.FullName), test);
if (result.Message != null)
failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
}
string msg = GettextCatalog.GetString ("Running {0} ...", test.FullName);
TextIter it = outputView.Buffer.EndIter;
outIters [test] = it.Offset;
outputView.Buffer.InsertWithTags (ref it, msg, bold);
outputView.Buffer.Insert (ref it, "\n");
if (result.ConsoleOutput != null)
outputView.Buffer.Insert (ref it, result.ConsoleOutput);
if (result.ConsoleError != null)
outputView.Buffer.Insert (ref it, result.ConsoleError);
outputView.ScrollMarkOnscreen (outputView.Buffer.InsertMark);
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:52,代码来源:TestResultsPad.cs
示例19: ToggleButton
void IPadContent.Initialize (IPadWindow window)
{
this.window = window;
DockItemToolbar toolbar = window.GetToolbar (PositionType.Top);
buttonSuccess = new ToggleButton ();
buttonSuccess.Label = GettextCatalog.GetString ("Successful Tests");
buttonSuccess.Active = false;
buttonSuccess.Image = new ImageView (TestStatusIcon.Success);
buttonSuccess.Image.Show ();
buttonSuccess.Toggled += new EventHandler (OnShowSuccessfulToggled);
buttonSuccess.TooltipText = GettextCatalog.GetString ("Show Successful Tests");
toolbar.Add (buttonSuccess);
buttonInconclusive = new ToggleButton ();
buttonInconclusive.Label = GettextCatalog.GetString ("Inconclusive Tests");
buttonInconclusive.Active = true;
buttonInconclusive.Image = new ImageView (TestStatusIcon.Inconclusive);
buttonInconclusive.Image.Show ();
buttonInconclusive.Toggled += new EventHandler (OnShowInconclusiveToggled);
buttonInconclusive.TooltipText = GettextCatalog.GetString ("Show Inconclusive Tests");
toolbar.Add (buttonInconclusive);
buttonFailures = new ToggleButton ();
buttonFailures.Label = GettextCatalog.GetString ("Failed Tests");
buttonFailures.Active = true;
buttonFailures.Image = new ImageView (TestStatusIcon.Failure);
buttonFailures.Image.Show ();
buttonFailures.Toggled += new EventHandler (OnShowFailuresToggled);
buttonFailures.TooltipText = GettextCatalog.GetString ("Show Failed Tests");
toolbar.Add (buttonFailures);
buttonIgnored = new ToggleButton ();
buttonIgnored.Label = GettextCatalog.GetString ("Ignored Tests");
buttonIgnored.Active = true;
buttonIgnored.Image = new ImageView (TestStatusIcon.NotRun);
buttonIgnored.Image.Show ();
buttonIgnored.Toggled += new EventHandler (OnShowIgnoredToggled);
buttonIgnored.TooltipText = GettextCatalog.GetString ("Show Ignored Tests");
toolbar.Add (buttonIgnored);
buttonOutput = new ToggleButton ();
buttonOutput.Label = GettextCatalog.GetString ("Output");
buttonOutput.Active = false;
buttonOutput.Image = ImageService.GetImage (MonoDevelop.Ide.Gui.Stock.OutputIcon, IconSize.Menu);
buttonOutput.Image.Show ();
buttonOutput.Toggled += new EventHandler (OnShowOutputToggled);
buttonOutput.TooltipText = GettextCatalog.GetString ("Show Output");
toolbar.Add (buttonOutput);
toolbar.Add (new SeparatorToolItem ());
buttonRun = new Button ();
buttonRun.Label = GettextCatalog.GetString ("Rerun Tests");
buttonRun.Image = new Gtk.Image (Gtk.Stock.Execute, IconSize.Menu);
buttonRun.Image.Show ();
buttonRun.Sensitive = false;
toolbar.Add (buttonRun);
buttonStop = new Button (new Gtk.Image (Ide.Gui.Stock.Stop, Gtk.IconSize.Menu));
toolbar.Add (buttonStop);
toolbar.ShowAll ();
buttonStop.Clicked += new EventHandler (OnStopClicked);
buttonRun.Clicked += new EventHandler (OnRunClicked);
// Run panel
DockItemToolbar runPanel = window.GetToolbar (PositionType.Bottom);
infoSep = new VSeparator ();
resultLabel.UseMarkup = true;
infoCurrent.Ellipsize = Pango.EllipsizeMode.Start;
infoCurrent.WidthRequest = 0;
runPanel.Add (resultLabel);
runPanel.Add (progressBar);
runPanel.Add (infoCurrent, true, 10);
labels = new HBox (false, 10);
infoLabel.UseMarkup = true;
labels.PackStart (infoLabel, true, false, 0);
runPanel.Add (new Gtk.Label (), true);
runPanel.Add (labels);
runPanel.Add (infoSep, false, 10);
progressBar.HeightRequest = infoLabel.SizeRequest ().Height;
runPanel.ShowAll ();
resultSummary = new UnitTestResult ();
UpdateCounters ();
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:95,代码来源:TestResultsPad.cs
示例20: CopyResult
UnitTestResult CopyResult (UnitTestResult origin)
{
var result = new UnitTestResult ();
result.Status = origin.Status;
result.Time = origin.Time;
result.ConsoleOutput = origin.ConsoleOutput;
result.Message = origin.Message;
result.StackTrace = origin.StackTrace;
result.Passed = session.Result.Passed;
result.Errors = session.Result.Errors;
result.Failures = session.Result.Failures;
result.Ignored = session.Result.Ignored;
result.Inconclusive = session.Result.Inconclusive;
result.Skipped = session.Result.Skipped;
return result;
}
开发者ID:lextm,项目名称:xamarinstudio.xunit,代码行数:19,代码来源:XUnitTestCase.cs
注:本文中的MonoDevelop.NUnit.UnitTestResult类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论