C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
FakeTestContext.cs
Go to the documentation of this file.
1using System;
2
4{
5 // "Poly-fill" missing properties of the NUnit TestContext object.
6#if NUNIT
7 public enum UnitTestOutcome { Unknown, Passed, Failed }
8
9 public class TestContext
10 {
11 private readonly NUnit.Framework.TestContext _base;
12 public TestContext(NUnit.Framework.TestContext original)
13 {
14 _base = original;
15 }
16 public string TestName => _base?.ToString() ?? "No Context";
17 public void WriteLine(string text) => Console.WriteLine(text);
18 public UnitTestOutcome CurrentTestOutcome =>
19 _base == null ? UnitTestOutcome.Unknown :
20 _base.Result.FailCount > 0 ? UnitTestOutcome.Failed :
21 UnitTestOutcome.Passed;
22 }
23
24 public class FakeTestContext : TestContext
25 {
26 public FakeTestContext() : base(null) { }
27 }
28#elif MSTEST
30 public class FakeTestContext : Microsoft.VisualStudio.TestTools.UnitTesting.TestContext
31 {
32 public override System.Collections.IDictionary Properties { get; }
33 public override System.Data.DataRow DataRow { get; }
34 public override System.Data.Common.DbConnection DataConnection { get; }
35 public override void Write(string message)
36 {
37 throw new NotImplementedException();
38 }
39
40 public override void Write(string format, params object[] args)
41 {
42 throw new NotImplementedException();
43 }
44
45 public override void WriteLine(string message)
46 {
47 throw new NotImplementedException();
48 }
49
50 public override void WriteLine(string format, params object[] args)
51 {
52 Console.WriteLine(format, args);
53 }
54
55 public override void AddResultFile(string fileName)
56 {
57 throw new NotImplementedException();
58 }
59
60 public override void BeginTimer(string timerName)
61 {
62 throw new NotImplementedException();
63 }
64
65 public override void EndTimer(string timerName)
66 {
67 throw new NotImplementedException();
68 }
69 }
70#endif
71}
@ Unknown
Indicates that no attempt has been made to authenticate with this access token.
@ Failed
Data has already been uploaded but failed processing.