本文整理汇总了C#中Connected.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Connected.Close方法的具体用法?C# Connected.Close怎么用?C# Connected.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connected
的用法示例。
在下文中一共展示了Connected.Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Close_Where_No_Pending_Publications_Which_Results_In_A_Context_Transition_To_Closed
public void Close_Where_No_Pending_Publications_Which_Results_In_A_Context_Transition_To_Closed()
{
var _busConfigurationBuilder = new BusConfigurationBuilder();
_busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri);
_busConfigurationBuilder
.RegisterPublication<MyEvent>(
TestingConfiguration.ExchangeName,
typeof(MyEvent).Name);
var _busConfirguration = _busConfigurationBuilder.Build();
var _connectionManager = Substitute.For<IConnectionManager>();
var _connection = Substitute.For<IConnection>();
var _channel = Substitute.For<IModel>();
var _context = Substitute.For<IBusContext>();
_connectionManager.Connection.Returns(_connection);
_connection.CreateModel().Returns(_channel);
var _SUT = new Connected(
_busConfirguration,
_connectionManager,
_context);
_context.State.Returns(callInfo => _SUT);
State _capturedState = null;
_context.When(context => context.State = Arg.Any<State>()).Do(callInfo => _capturedState = callInfo[0] as State);
_SUT.Close();
Assert.IsInstanceOf<Closed>(_capturedState);
}