本文整理汇总了C#中Connected类的典型用法代码示例。如果您正苦于以下问题:C# Connected类的具体用法?C# Connected怎么用?C# Connected使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Connected类属于命名空间,在下文中一共展示了Connected类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DdpClient_ConnectAsync_SetsSessionId
public void DdpClient_ConnectAsync_SetsSessionId()
{
var task = this.client.ConnectAsync();
var connected = new Connected() {MessageType = "connected", Session = "TestSession"};
this.testConnection.Reply(JsonConvert.SerializeObject(connected));
task.Wait();
Assert.AreEqual(this.client.SessionId, "TestSession", "Session should be set after successful connection.");
}
示例2: ConnectedResultFilter_HandleReturnObject_ConnectedMessage
public void ConnectedResultFilter_HandleReturnObject_ConnectedMessage()
{
var connectedResultFilter = new ConnectedResultFilter();
var connected = new Connected() {Session = "Test"};
var returnedObject = new ReturnedObject("connected", JObject.FromObject(connected),
JsonConvert.SerializeObject(connected));
connectedResultFilter.HandleReturnObject(returnedObject);
Assert.IsTrue(connectedResultFilter.IsCompleted());
Assert.AreEqual(returnedObject, connectedResultFilter.GetReturnedObject());
}
示例3: ResultHandler_WaitForResult_WaitHandler
public void ResultHandler_WaitForResult_WaitHandler()
{
var resultHandler = new ResultHandler();
var waitHandle = resultHandler.RegisterWaitHandler(ResultFilterFactory.CreateConnectResultFilter());
var waitTask = resultHandler.WaitForResult(waitHandle);
var connected = new Connected() {Session = "TestSession"};
var returnedObject = new ReturnedObject(connected.MessageType, JObject.FromObject(connected),
JsonConvert.SerializeObject(connected));
resultHandler.AddResult(returnedObject);
waitTask.Wait();
Assert.AreEqual(returnedObject, waitTask.Result);
}
示例4: ReplyMessageHandler_HandleMessage_HandlesConnected
public void ReplyMessageHandler_HandleMessage_HandlesConnected()
{
var connectionMock = new Mock<IDdpConnectionSender>();
var collectionMock = new Mock<ICollectionManager>();
var resultHandlerMock = new Mock<IResultHandler>();
var connected = new Connected() {Session = "1"};
var handler = new ReplyMessageHandler();
handler.HandleMessage(connectionMock.Object, collectionMock.Object, resultHandlerMock.Object,
JsonConvert.SerializeObject(connected));
Assert.IsTrue(handler.CanHandle(connected.MessageType));
resultHandlerMock.Verify(resultHandler => resultHandler.AddResult(It.IsAny<ReturnedObject>()));
}
示例5: DdpClient_ConnectAsync_SendsConnectMessage
public void DdpClient_ConnectAsync_SendsConnectMessage()
{
var task = this.client.ConnectAsync();
var connected = new Connected() { MessageType = "connected", Session = "TestSession" };
this.testConnection.Reply(JsonConvert.SerializeObject(connected));
task.Wait();
var message = this.testConnection.GetSentMessage();
var connectMessage = JsonConvert.DeserializeObject<Connect>(message);
Assert.IsNotNull(connectMessage, "Connect should send an object");
Assert.AreEqual(connectMessage.Version, "1", "Message should support version 1");
Assert.AreEqual(connectMessage.VersionsSupported.Count(), 1, "Client only supports 1 version");
Assert.AreEqual(connectMessage.VersionsSupported.First(), "1", "Client only supports 1 version");
}
示例6: ResultHandler_RegisterResultCallback_CallbackCalled
public void ResultHandler_RegisterResultCallback_CallbackCalled()
{
var resultHandler = new ResultHandler();
bool callbackCalled = false;
var connected = new Connected() { Session = "TestSession" };
var returnedObject = new ReturnedObject(connected.MessageType, JObject.FromObject(connected),
JsonConvert.SerializeObject(connected));
resultHandler.RegisterResultCallback(ResultFilterFactory.CreateConnectResultFilter(), o =>
{
callbackCalled = true;
Assert.AreEqual(returnedObject, o);
});
resultHandler.AddResult(returnedObject);
Assert.IsTrue(callbackCalled);
}
示例7: ResultHandler_WaitForResult_ReactivateWaitHandle
public void ResultHandler_WaitForResult_ReactivateWaitHandle()
{
var resultHandler = new ResultHandler();
var waitHandle = resultHandler.RegisterWaitHandler(ResultFilterFactory.CreateConnectResultFilter());
var waitTask = resultHandler.WaitForResult(waitHandle);
var connected = new Connected() { Session = "TestSession" };
var returnedObject = new ReturnedObject(connected.MessageType, JObject.FromObject(connected),
JsonConvert.SerializeObject(connected));
resultHandler.AddResult(returnedObject);
waitTask.Wait();
Assert.AreEqual(returnedObject, waitTask.Result);
PCLTesting.ExceptionAssert.Throws<InvalidOperationException>(() => resultHandler.WaitForResult(waitHandle));
}
示例8: PublishAsync_Where_No_Publication_Configurations_Which_Results_In_A_NoConfigurationFound_Result
public void PublishAsync_Where_No_Publication_Configurations_Which_Results_In_A_NoConfigurationFound_Result()
{
var _busConfigurationBuilder = new BusConfigurationBuilder();
_busConfigurationBuilder.ConnectionUris.Add(TestingConfiguration.LocalConnectionUri);
var _busConfirguration = _busConfigurationBuilder.Build();
var _connectionManager = Substitute.For<IConnectionManager>();
var _context = Substitute.For<IBusContext>();
var _SUT = new Connected(
_busConfirguration,
_connectionManager,
_context);
var _theEvent = new MyEvent(Guid.NewGuid(), null, "Some detail", 1);
var _publicationResult = _SUT.PublishAsync(_theEvent);
_publicationResult.Wait();
Assert.AreEqual(PMCG.Messaging.PublicationResultStatus.NoConfigurationFound, _publicationResult.Result.Status);
}
示例9: ZeroCrossings
public static void ZeroCrossings(DoubleImage src, DoubleImage dest, Connected con) {
VisionLabPINVOKE.ZeroCrossings__SWIG_12(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), (int)con);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
}
示例10: ConnectedToStr
public static string ConnectedToStr(Connected con) {
string ret = VisionLabPINVOKE.ConnectedToStr((int)con);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例11: RemoveBorderBlobs
public static void RemoveBorderBlobs(Int32Image image, Connected connected) {
VisionLabPINVOKE.RemoveBorderBlobs__SWIG_9(Int32Image.getCPtr(image), (int)connected);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
}
示例12: RemoveGrayScaleBlobs
public static int RemoveGrayScaleBlobs(Int16Image image, Int16Image grayImage, Connected connected, BlobAnalyse ba, double low, double high, UseXOrY xy, BlobAnalyseModifier baMod) {
int ret = VisionLabPINVOKE.RemoveGrayScaleBlobs__SWIG_9(Int16Image.getCPtr(image), Int16Image.getCPtr(grayImage), (int)connected, (int)ba, low, high, (int)xy, BlobAnalyseModifier.getCPtr(baMod));
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例13: NrOfNeighbours
public static void NrOfNeighbours(Int32Image src, Int32Image dest, Connected connected) {
VisionLabPINVOKE.NrOfNeighbours__SWIG_4(Int32Image.getCPtr(src), Int32Image.getCPtr(dest), (int)connected);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
}
示例14: FindSpecificGrayScaleHoles
public static int FindSpecificGrayScaleHoles(Int32Image image, Int32Image grayImage, Connected connected, BlobAnalyse ba, double low, double high, UseXOrY xy) {
int ret = VisionLabPINVOKE.FindSpecificGrayScaleHoles__SWIG_13(Int32Image.getCPtr(image), Int32Image.getCPtr(grayImage), (int)connected, (int)ba, low, high, (int)xy);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
示例15: FindBlob
public static int FindBlob(Int32Image src, Int32Image pat, Int32Image dest, Connected connected, float maxError, float beginAngle, float endAngle, int nrOfRotations) {
int ret = VisionLabPINVOKE.FindBlob__SWIG_19(Int32Image.getCPtr(src), Int32Image.getCPtr(pat), Int32Image.getCPtr(dest), (int)connected, maxError, beginAngle, endAngle, nrOfRotations);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}