本文整理汇总了C#中Dev2.AppResources.Repositories.StudioResourceRepository.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# StudioResourceRepository.Disconnect方法的具体用法?C# StudioResourceRepository.Disconnect怎么用?C# StudioResourceRepository.Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dev2.AppResources.Repositories.StudioResourceRepository
的用法示例。
在下文中一共展示了StudioResourceRepository.Disconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupEnvironmentRepo
public void StudioResourceRepository_Disconnect_PublishesRemoveEnvironmentMessage_ServerIsDisconnectedAndChildrenAreCollapsed()
{
//------------Setup for test--------------------------
var aggregator = new Mock<EventAggregator>();
IEnvironmentModel actualEnvironmentInvoked = null;
aggregator.Setup(a => a.Publish(It.IsAny<RemoveEnvironmentMessage>())).Callback<object>(msg =>
{
var workSurfaceObject = (msg is RemoveEnvironmentMessage) ? (msg as RemoveEnvironmentMessage).EnvironmentModel : null;
actualEnvironmentInvoked = workSurfaceObject;
});
EventPublishers.Aggregator = aggregator.Object;
var environmentId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var repository = new StudioResourceRepository(GetTestData(), environmentId, _invoke);
//------------Execute Test---------------------------
var countBeforeDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedBeforeDisconnect = repository.ExplorerItemModels[0].IsConnected;
repository.Disconnect(environmentId);
var countAfterDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedAfterDisconnect = repository.ExplorerItemModels[0].IsConnected;
//------------Assert Results-------------------------
Assert.AreEqual(2, countBeforeDisconnect);
Assert.AreEqual(0, countAfterDisconnect);
Assert.AreEqual(true, isConnectedBeforeDisconnect);
Assert.AreEqual(false, isConnectedAfterDisconnect);
Assert.IsNull(actualEnvironmentInvoked);
}
示例2: StudioResourceRepository_Disconnect_ServerHasChildren_ServerIsDisconnectedAndChildrenAreCollapsed
public void StudioResourceRepository_Disconnect_ServerHasChildren_ServerIsDisconnectedAndChildrenAreCollapsed()
{
//------------Setup for test--------------------------
var environmentId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var repository = new StudioResourceRepository(GetTestData(), environmentId, _invoke);
//------------Execute Test---------------------------
var countBeforeDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedBeforeDisconnect = repository.ExplorerItemModels[0].IsConnected;
repository.Disconnect(environmentId);
var countAfterDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedAfterDisconnect = repository.ExplorerItemModels[0].IsConnected;
//------------Assert Results-------------------------
Assert.AreEqual(2, countBeforeDisconnect);
Assert.AreEqual(0, countAfterDisconnect);
Assert.AreEqual(true, isConnectedBeforeDisconnect);
Assert.AreEqual(false, isConnectedAfterDisconnect);
}