本文整理汇总了C#中MessageBus.HasSubscriberFor方法的典型用法代码示例。如果您正苦于以下问题:C# MessageBus.HasSubscriberFor方法的具体用法?C# MessageBus.HasSubscriberFor怎么用?C# MessageBus.HasSubscriberFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageBus
的用法示例。
在下文中一共展示了MessageBus.HasSubscriberFor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FalseWithNoSubscribers
public void FalseWithNoSubscribers()
{
var bus = new MessageBus();
bus.HasSubscriberFor<Message>()
.Should().BeFalse(
"no subscribers have been added");
}
示例2: TrueWithExactMatch
public void TrueWithExactMatch()
{
var bus = new MessageBus();
bus.SubscriberFor<Message>(m => { });
bus.HasSubscriberFor<Message>()
.Should().BeTrue(
"subscriber for type was added");
}
示例3: TrueWithDerivedType
public void TrueWithDerivedType()
{
var bus = new MessageBus();
bus.SubscriberFor<TestMessageBase>(m => { });
bus.HasSubscriberFor<TestMessageTypeA>()
.Should().BeTrue(
"subscriber for super type was added");
}
示例4: FalseWithSuperType
public void FalseWithSuperType()
{
var bus = new MessageBus();
bus.SubscriberFor<TestMessageTypeA>(m => { });
bus.HasSubscriberFor<TestMessageBase>()
.Should().BeFalse(
"subscriber for derived type was added");
}
示例5: FalseWithNonMatch
public void FalseWithNonMatch()
{
var bus = new MessageBus();
bus.SubscriberFor<TestMessageTypeA>(m => { });
bus.HasSubscriberFor<TestMessageTypeB>()
.Should().BeFalse(
"no subscriber for type was added");
}