本文整理汇总了C#中Connected类的典型用法代码示例。如果您正苦于以下问题:C# Connected类的具体用法?C# Connected怎么用?C# Connected使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Connected类属于命名空间,在下文中一共展示了Connected类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.");
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:11,代码来源:ConnectionTests.cs
示例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());
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:15,代码来源:ConnectedResultFilterTests.cs
示例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);
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:17,代码来源:ResultHandlerTests.cs
示例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>()));
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:17,代码来源:ReplyMessageHandlerTests.cs
示例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");
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:18,代码来源:ConnectionTests.cs
示例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);
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:19,代码来源:ResultHandlerTests.cs
示例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));
}
开发者ID:Lavan,项目名称:DdpNet,代码行数:19,代码来源:ResultHandlerTests.cs
示例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);
}
开发者ID:pmcgrath,项目名称:PMCG.Messaging,代码行数:20,代码来源:ConnectedSpec.cs
示例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();
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:4,代码来源:VisionLab.cs
示例10: ConnectedToStr
public static string ConnectedToStr(Connected con) {
string ret = VisionLabPINVOKE.ConnectedToStr((int)con);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例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();
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:4,代码来源:VisionLab.cs
示例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;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例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();
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:4,代码来源:VisionLab.cs
示例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;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例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;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例16: FindSpecificHoles
public static int FindSpecificHoles(Int16Image image, Connected connected, BlobAnalyse ba, double low, double high) {
int ret = VisionLabPINVOKE.FindSpecificHoles__SWIG_11(Int16Image.getCPtr(image), (int)connected, (int)ba, low, high);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例17: ApproxPolygon
public static int ApproxPolygon(Int32Image image, Connected connected, double minDistance, int maxVertices, vector_XYCoord tab) {
int ret = VisionLabPINVOKE.ApproxPolygon__SWIG_4(Int32Image.getCPtr(image), (int)connected, minDistance, maxVertices, vector_XYCoord.getCPtr(tab));
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例18: LabelBlobs
public static int LabelBlobs(Int32Image image, Connected connected) {
int ret = VisionLabPINVOKE.LabelBlobs__SWIG_4(Int32Image.getCPtr(image), (int)connected);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
示例19: BlobAnd
public static void BlobAnd(Int32Image image, Int32Image maskImage, Connected connected) {
VisionLabPINVOKE.BlobAnd__SWIG_4(Int32Image.getCPtr(image), Int32Image.getCPtr(maskImage), (int)connected);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:4,代码来源:VisionLab.cs
示例20: RemoveBlobs
public static int RemoveBlobs(Int16Image image, Connected connected, BlobAnalyse ba, double low, double high, UseXOrY xy) {
int ret = VisionLabPINVOKE.RemoveBlobs__SWIG_10(Int16Image.getCPtr(image), (int)connected, (int)ba, low, high, (int)xy);
if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
开发者ID:eddiesprietsma,项目名称:licplates11Okt12_b,代码行数:5,代码来源:VisionLab.cs
注:本文中的Connected类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论