本文整理汇总了C#中Signal.Raise方法的典型用法代码示例。如果您正苦于以下问题:C# Signal.Raise方法的具体用法?C# Signal.Raise怎么用?C# Signal.Raise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal.Raise方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: increase_signal_counter_on_every_Raise_invocation
public void increase_signal_counter_on_every_Raise_invocation()
{
var sut = new Signal("myname");
sut.Raise("hello");
sut.Raise("hello");
sut.Raise("hello");
sut.RaiseCountSinceLastReset.Should().Be(3);
}
示例2: Raise_signal_on_first_invocation
public void Raise_signal_on_first_invocation()
{
var sut = new Signal("name");
var actual = sut.Raise("No reason");
actual.Should().BeTrue();
}
示例3: Raise_signal_on_first_invocation_should_trigger_event
public void Raise_signal_on_first_invocation_should_trigger_event()
{
var sut = new Signal("name");
var actual = false;
sut.Raised += (sender, args) => actual = true;
sut.Raise("No reason");
actual.Should().BeTrue();
}
示例4: raise_should_reset_idle_time
public void raise_should_reset_idle_time()
{
var sut = new Signal("myname");
sut.Raise("nothing");
sut.IdleSinceUtc.Should().Be(DateTime.MinValue);
}
示例5: set_signal_time_when_raising
public void set_signal_time_when_raising()
{
var sut = new Signal("myname");
sut.Raise("nothing");
sut.RaisedSinceUtc.Should().BeCloseTo(DateTime.UtcNow);
}
示例6: reset_signal_should_set_idle_time
public void reset_signal_should_set_idle_time()
{
var sut = new Signal("myname");
sut.Raise("nothing");
sut.Reset();
sut.IdleSinceUtc.Should().BeCloseTo(DateTime.UtcNow);
}
示例7: reset_signal_time_on_suppress
public void reset_signal_time_on_suppress()
{
var sut = new Signal("myname");
sut.Raise("nothing");
sut.Reset();
sut.RaisedSinceUtc.Should().Be(DateTime.MinValue);
}
示例8: reset_signal_counter_on_reset
public void reset_signal_counter_on_reset()
{
var sut = new Signal("myname");
sut.Raise("hello");
sut.Raise("hello");
sut.Raise("hello");
sut.Reset();
sut.RaiseCountSinceLastReset.Should().Be(0);
}
示例9: reset_should_not_return_true_when_being_signaled
public void reset_should_not_return_true_when_being_signaled()
{
var sut = new Signal("name");
sut.Raise("not here");
var actual = sut.Reset();
actual.Should().BeTrue("because signal is not raised");
}
示例10: reset_should_invoke_event_when_signaled
public void reset_should_invoke_event_when_signaled()
{
var sut = new Signal("name");
sut.Raise("not here");
var actual = false;
sut.Suppressed += (sender, args) => actual = true;
sut.Reset();
actual.Should().BeTrue("because signal is not raised");
}
示例11: raise_signal_on_second_invocation_should_not_return_true
public void raise_signal_on_second_invocation_should_not_return_true()
{
var sut = new Signal("name");
sut.Raise("no reason");
var actual = sut.Raise("No reason");
actual.Should().BeFalse("because signal is already raised");
}
示例12: raise_signal_on_second_invocation_should_not_raise_event_with_the_exception_overload
public void raise_signal_on_second_invocation_should_not_raise_event_with_the_exception_overload()
{
var sut = new Signal("name");
sut.Raise("no reason", new ExternalException());
var actual = false;
sut.Raised += (sender, args) => actual = true;
sut.Raise("No reason");
actual.Should().BeFalse("because signal is already raised");
}