本文整理汇总了C#中IMessageSink类的典型用法代码示例。如果您正苦于以下问题:C# IMessageSink类的具体用法?C# IMessageSink怎么用?C# IMessageSink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMessageSink类属于命名空间,在下文中一共展示了IMessageSink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XunitTestAssemblyRunnerWithAssemblyFixture
public XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssembly,
IEnumerable<IXunitTestCase> testCases,
IMessageSink diagnosticMessageSink,
IMessageSink executionMessageSink,
ITestFrameworkExecutionOptions executionOptions)
: base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
{ }
示例2: concat_id
public static LNode concat_id(LNode node, IMessageSink sink)
{
var args = node.Args;
if (args.Count == 0)
return null;
if (args.Slice(0, args.Count - 1).Any(n => n.IsCall))
return Reject(sink, node, "All arguments to ##() or concat() must be identifiers or literals (except the last one)");
RVList<LNode> attrs = node.Attrs;
LNode arg = null;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < args.Count; i++)
{
arg = args[i];
attrs.AddRange(arg.Attrs);
if (arg.IsLiteral)
sb.Append(arg.Value ?? "null");
else if (arg.IsId)
sb.Append(arg.Name);
else { // call
if (i + 1 != args.Count || !arg.HasSimpleHead())
return Reject(sink, arg, "Expected simple identifier or literal");
sb.Append(arg.Name);
}
}
Symbol combined = GSymbol.Get(sb.ToString());
LNode result;
if (arg.IsCall)
result = arg.WithTarget(combined);
else
result = LNode.Id(combined, node);
return result.WithAttrs(attrs);
}
示例3: GetTestFrameworkType
static Type GetTestFrameworkType(IAssemblyInfo testAssembly, IMessageSink diagnosticMessageSink)
{
try
{
var testFrameworkAttr = testAssembly.GetCustomAttributes(typeof(ITestFrameworkAttribute)).FirstOrDefault();
if (testFrameworkAttr != null)
{
var discovererAttr = testFrameworkAttr.GetCustomAttributes(typeof(TestFrameworkDiscovererAttribute)).FirstOrDefault();
if (discovererAttr != null)
{
var discoverer = ExtensibilityPointFactory.GetTestFrameworkTypeDiscoverer(diagnosticMessageSink, discovererAttr);
if (discoverer != null)
return discoverer.GetTestFrameworkType(testFrameworkAttr);
var ctorArgs = discovererAttr.GetConstructorArguments().ToArray();
diagnosticMessageSink.OnMessage(new DiagnosticMessage($"Unable to create custom test framework discoverer type '{ctorArgs[1]}, {ctorArgs[0]}'"));
}
else
{
diagnosticMessageSink.OnMessage(new DiagnosticMessage("Assembly-level test framework attribute was not decorated with [TestFrameworkDiscoverer]"));
}
}
}
catch (Exception ex)
{
diagnosticMessageSink.OnMessage(new DiagnosticMessage($"Exception thrown during test framework discoverer construction: {ex.Unwrap()}"));
}
return typeof(XunitTestFramework);
}
示例4: MessageBus
/// <summary/>
public MessageBus(IMessageSink messageSink)
{
this.messageSink = messageSink;
reporterThread = new Thread(ReporterWorker);
reporterThread.Start();
}
示例5: AsyncProcessMessage
public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
{
WorkItem work = new WorkItem(reqMsg, this._nextSink, replySink);
work.SetAsync();
this._property.HandleWorkRequest(work);
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SynchronizedServerContextSink.cs
示例6: RemoteToInternalSpecificationRunListenerAdapter
protected RemoteToInternalSpecificationRunListenerAdapter(object listener, string runOptionsXml)
{
_listener = (IMessageSink)listener;
this.RunOptions = RunOptions.Parse(runOptionsXml);
this.Runner = new DefaultRunner(this, RunOptions);
}
示例7: Xunit2Discoverer
// Used by Xunit2 when initializing for both discovery and execution.
internal Xunit2Discoverer(ISourceInformationProvider sourceInformationProvider,
string assemblyFileName,
string configFileName,
bool shadowCopy,
string shadowCopyFolder = null,
IMessageSink diagnosticMessageSink = null)
: this(sourceInformationProvider, null, assemblyFileName, GetXunitExecutionAssemblyPath(assemblyFileName), configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink) { }
示例8: Run
/// <inheritdoc/>
public void Run(IEnumerable<ITestCase> testMethods, IMessageSink messageSink)
{
bool cancelled = false;
var totalSummary = new RunSummary();
string currentDirectory = Directory.GetCurrentDirectory();
try
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(assemblyInfo.AssemblyPath));
if (messageSink.OnMessage(new TestAssemblyStarting()))
{
var classGroups = testMethods.Cast<XunitTestCase>().GroupBy(tc => tc.Class).ToList();
if (classGroups.Count > 0)
{
var collectionSummary = new RunSummary();
if (messageSink.OnMessage(new TestCollectionStarting()))
{
foreach (var group in classGroups)
{
var classSummary = new RunSummary();
if (!messageSink.OnMessage(new TestClassStarting { ClassName = group.Key.Name }))
cancelled = true;
else
{
cancelled = RunTestClass(messageSink, group, classSummary);
collectionSummary.Aggregate(classSummary);
}
if (!messageSink.OnMessage(new TestClassFinished { Assembly = assemblyInfo, ClassName = group.Key.Name, TestsRun = classSummary.Total }))
cancelled = true;
if (cancelled)
break;
}
}
messageSink.OnMessage(new TestCollectionFinished { Assembly = assemblyInfo, TestsRun = collectionSummary.Total });
totalSummary.Aggregate(collectionSummary);
}
}
messageSink.OnMessage(new TestAssemblyFinished
{
Assembly = assemblyInfo,
TestsRun = totalSummary.Total,
TestsFailed = totalSummary.Failed,
TestsSkipped = totalSummary.Skipped,
ExecutionTime = totalSummary.Time
});
}
finally
{
Directory.SetCurrentDirectory(currentDirectory);
}
}
示例9: CollectionPerAssemblyTestCollectionFactory
/// <summary>
/// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
/// </summary>
/// <param name="testAssembly">The assembly.</param>
/// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink)
{
this.testAssembly = testAssembly;
defaultCollection = new TestCollection(testAssembly, null, "Test collection for " + Path.GetFileName(testAssembly.Assembly.AssemblyPath));
collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, diagnosticMessageSink);
}
示例10: InterceptSink
public InterceptSink(IMessageSink nextSink)
{
lock (SyncRoot)
{
_nextSink = nextSink;
}
}
示例11: BenchmarkTestCase
public BenchmarkTestCase(
int iterations,
int warmupIterations,
string variation,
IMessageSink diagnosticMessageSink,
ITestMethod testMethod,
object[] testMethodArguments)
: base(diagnosticMessageSink, Xunit.Sdk.TestMethodDisplay.Method, testMethod, null)
{
// Override display name to avoid getting info about TestMethodArguments in the
// name (this is covered by the concept of Variation for benchmarks)
var suppliedDisplayName = TestMethod.Method.GetCustomAttributes(typeof(FactAttribute))
.First()
.GetNamedArgument<string>("DisplayName");
_diagnosticMessageSink = diagnosticMessageSink;
DisplayName = suppliedDisplayName ?? BaseDisplayName;
Variation = variation;
Iterations = iterations;
WarmupIterations = warmupIterations;
var methodArguments = new List<object> { MetricCollector };
if (testMethodArguments != null)
{
methodArguments.AddRange(testMethodArguments);
}
TestMethodArguments = methodArguments.ToArray();
}
示例12: ScenarioOutlineRunner
public ScenarioOutlineRunner(
IMessageSink diagnosticMessageSink,
IXunitTestCase scenarioOutline,
string displayName,
string skipReason,
object[] constructorArguments,
IMessageBus messageBus,
ExceptionAggregator aggregator,
CancellationTokenSource cancellationTokenSource)
: base(
scenarioOutline,
displayName,
skipReason,
constructorArguments,
noArguments,
messageBus,
aggregator,
cancellationTokenSource)
{
this.diagnosticMessageSink = diagnosticMessageSink;
this.scenarioRunnerFactory = new ScenarioRunnerFactory(
this.TestCase,
this.DisplayName,
this.MessageBus,
this.TestClass,
this.ConstructorArguments,
this.SkipReason,
this.BeforeAfterAttributes,
this.Aggregator,
this.CancellationTokenSource);
}
示例13: RunTestCases
protected override void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink messageSink, ITestFrameworkOptions executionOptions)
{
var cases = testCases.Where(t =>
t.Class.GetCustomAttributes(typeof(RunIfConfiguredAttribute)) == null
|| TestConfig.Instance.IsConfigured);
base.RunTestCases(cases, messageSink, executionOptions);
}
示例14: DoAsyncDispatch
internal static IMessageCtrl DoAsyncDispatch(IMessage reqMsg, IMessageSink replySink)
{
object[] args = new object[4];
ServerIdentity serverIdentity = InternalSink.GetServerIdentity(reqMsg);
if (RemotingServices.CORProfilerTrackRemotingAsync())
{
Guid empty = Guid.Empty;
if (RemotingServices.CORProfilerTrackRemotingCookie())
{
object obj2 = reqMsg.Properties["CORProfilerCookie"];
if (obj2 != null)
{
empty = (Guid) obj2;
}
}
RemotingServices.CORProfilerRemotingServerReceivingMessage(empty, true);
if (replySink != null)
{
IMessageSink sink = new ServerAsyncReplyTerminatorSink(replySink);
replySink = sink;
}
}
Context serverContext = serverIdentity.ServerContext;
args[0] = reqMsg;
args[1] = replySink;
args[2] = Thread.CurrentContext;
args[3] = serverContext;
InternalCrossContextDelegate ftnToCall = new InternalCrossContextDelegate(CrossContextChannel.DoAsyncDispatchCallback);
return (IMessageCtrl) Thread.CurrentThread.InternalCrossContextCallback(serverContext, ftnToCall, args);
}
示例15: ForwardMethod
public static LNode ForwardMethod(LNode fn, IMessageSink sink)
{
LNode args, fwd, body;
if (fn.ArgCount != 4 || !(fwd = fn.Args[3]).Calls(S.Forward, 1) || !(args = fn.Args[2]).Calls(S.List))
return null;
RVList<LNode> formalArgs = args.Args;
RVList<LNode> argList = RVList<LNode>.Empty;
foreach (var formalArg in formalArgs)
{
if (!formalArg.Calls(S.Var, 2))
return Reject(sink, formalArg, "'==>' expected a variable declaration here");
LNode argName = formalArg.Args[1];
if (argName.Calls(S.Assign, 2))
argName = argName.Args[0];
LNode @ref = formalArg.AttrNamed(S.Ref) ?? formalArg.AttrNamed(S.Out);
if (@ref != null)
argName = argName.PlusAttr(@ref);
argList.Add(argName);
}
LNode target = GetForwardingTarget(fwd, fn.Args[1]);
LNode call = F.Call(target, argList);
bool isVoidFn = fn.Args[0].IsIdNamed(S.Void);
body = F.Braces(isVoidFn ? call : F.Call(S.Return, call));
return fn.WithArgChanged(3, body);
}