当前位置: 首页>>代码示例>>C#>>正文


C# TestMessage类代码示例

本文整理汇总了C#中TestMessage的典型用法代码示例。如果您正苦于以下问题:C# TestMessage类的具体用法?C# TestMessage怎么用?C# TestMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestMessage类属于命名空间,在下文中一共展示了TestMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldForwardPolymorphicMessage

 public void ShouldForwardPolymorphicMessage()
 {
     var handler = new TestEventHandler();
     var message = new TestMessage();
     EventFns.Forward(handler, message);
     Assert.IsTrue(handler.IMessageHandled, "Message should have been handled");
 }
开发者ID:ValdimarThor,项目名称:Cocktail,代码行数:7,代码来源:EventHandlerUnitTests.cs

示例2: ServiceQueue_1_Writer_1_Reader

        public void ServiceQueue_1_Writer_1_Reader(ServiceQueueRotationAlgorithm algorithm)
        {
            using (var serviceQueue = new ServiceQueue(algorithm))
            using (var reader = new ServiceQueueReader())
            using (var writer = new ServiceQueueWriter())
            {
                var endpoint = GetEndpoint();
                serviceQueue.Bind(endpoint);

                var counterSignal = new CounterSignal(NumberOfMessages, 0);
                reader.MessageReceived += (s, m) => counterSignal.Increment();

                reader.Connect(endpoint);
                writer.Connect(endpoint);

                var messageSent = new TestMessage();

                var sw = Stopwatch.StartNew();
                for (var i = 0; i < NumberOfMessages; i++)
                {
                    writer.SendMessage(messageSent);
                }
                Assert.IsTrue(counterSignal.Wait(TimeOut), "Timeout waiting for message");
                sw.Stop();

                Assert.Inconclusive("{0} elapsed reading {1} messages ({2:N0} per second)", sw.Elapsed, NumberOfMessages, NumberOfMessages / sw.Elapsed.TotalSeconds);

            }
        }
开发者ID:tleviathan,项目名称:redfoxmq,代码行数:29,代码来源:ServiceQueueBenchmarks.cs

示例3: SerialiseMessageWithGuid

        public void SerialiseMessageWithGuid()
        {
            var message = new TestMessage { Id = Guid.Parse("C50DDB56-B827-46E3-9D7D-ACB701882624") };
             var serialisedMessage = this.componentUnderTest.Serialise(message);

             Assert.That(serialisedMessage, Is.EqualTo(MessageWithGuid));
        }
开发者ID:hariharanpalani,项目名称:service-bus,代码行数:7,代码来源:SerialiseShould.cs

示例4: Should_properly_arrive_at_the_destination

		public void Should_properly_arrive_at_the_destination()
		{
			var serviceUri = new Uri("net.pipe://localhost/pipe");
			string pipeName = "test";

			var future = new Future<TestMessage>();
			var message = new TestMessage
				{
					Id = Guid.NewGuid(),
					Name = "Alpha",
				};

			UntypedChannel adapter = new ChannelAdapter();
			using (var remote = new WcfChannelHost(new SynchronousFiber(), adapter, serviceUri, pipeName))
			{
				using (adapter.Connect(x =>
					{
						x.AddConsumerOf<TestMessage>()
							.UsingConsumer(m => future.Complete(m));
					}))
				{
					var client = new WcfChannelProxy(new SynchronousFiber(), serviceUri, pipeName);

					client.Send(message);

					future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue();
				}
			}

			future.Value.ShouldNotBeNull();
			future.Value.ShouldEqual(message);
			future.Value.ShouldNotBeTheSameAs(message);
		}
开发者ID:Nangal,项目名称:Stact,代码行数:33,代码来源:RemoteChannel_Specs.cs

示例5: One_Publisher_One_Subscriber_Batch_Broadcast

        public void One_Publisher_One_Subscriber_Batch_Broadcast()
        {
            using (var publisher = new Publisher())
            using (var subscriber = new Subscriber())
            {
                var endpoint = GetEndpoint();
                publisher.Bind(endpoint);
                subscriber.Connect(endpoint);

                Thread.Sleep(100);

                var counterSignal = new CounterSignal(NumberOfMessagesToReceive);
                subscriber.MessageReceived += (s, m) => counterSignal.Increment();

                var messageSent = new TestMessage();

                var batch = new List<TestMessage>();
                for (var i = 0; i < NumberOfMessagesToReceive; i++)
                    batch.Add(messageSent);

                var sw = Stopwatch.StartNew();
                publisher.Broadcast(batch);
                Assert.IsTrue(counterSignal.Wait(TimeOut), "Timeout waiting for message");
                sw.Stop();

                Assert.Inconclusive("{0} elapsed reading {1} messages ({2:N0} per second)", sw.Elapsed, NumberOfMessagesToReceive, NumberOfMessagesToReceive / sw.Elapsed.TotalSeconds);
            }
        }
开发者ID:tleviathan,项目名称:redfoxmq,代码行数:28,代码来源:PublisherSubscriberBenchmarks.cs

示例6: SetsTheValueOfTheMessageProperty

        public void SetsTheValueOfTheMessageProperty()
        {
            var message = new TestMessage();

            var routeResult = new RouteResult(message, null);

            Assert.That(routeResult.Message, Is.SameAs(message));
        }
开发者ID:peteraritchie,项目名称:Rock.Messaging,代码行数:8,代码来源:RouteResultTests.cs

示例7: GetInstance_NullInstanceContext

 public void GetInstance_NullInstanceContext()
 {
     var data = new ServiceImplementationData();
     var container = new ContainerBuilder().Build();
     var provider = new AutofacInstanceProvider(container, data);
     var message = new TestMessage();
     Assert.Throws<ArgumentNullException>(() => provider.GetInstance(null, message));
 }
开发者ID:RoymanJing,项目名称:Autofac,代码行数:8,代码来源:AutofacInstanceProviderFixture.cs

示例8: send_waiting_message_fires_event_hooks

		public void send_waiting_message_fires_event_hooks ()
		{
			var msg = new TestMessage();
			((SenderNode)_subject).SendMessage(msg);

			_eventHook1.Received().MessageSent(msg);
			_eventHook2.Received().MessageSent(msg);
		}
开发者ID:i-e-b,项目名称:SevenDigital.Messaging,代码行数:8,代码来源:SenderNodeTests.cs

示例9: TestBroker

 public void TestBroker()
 {
     TestMessage message = new TestMessage {Id = Guid.NewGuid(), Text = "Some text"};
     MessageBroker broker = new MessageBroker();
     broker.Write(message);
     TestMessage readMessage = broker.Read<TestMessage>(0);
     Assert.IsNotNull(readMessage);
 }
开发者ID:mikael-kuhn,项目名称:mscourse,代码行数:8,代码来源:UnitTest1.cs

示例10: Should_be_able_to_serialize_and_deserialize_a_message

        public void Should_be_able_to_serialize_and_deserialize_a_message()
        {
            var initialMessage = new TestMessage {Text = "Hello!"};
            var serializedMessage = serializer.MessageToBytes(initialMessage);
            var deserializedMessage = serializer.BytesToMessage<TestMessage>(serializedMessage);

            deserializedMessage.Text.ShouldEqual(initialMessage.Text);
        }
开发者ID:ngbrown,项目名称:EasyNetQ,代码行数:8,代码来源:BinarySerializerTests.cs

示例11: Definition_should_allow_to_retrieve_proper_correlation_id

        public void Definition_should_allow_to_retrieve_proper_correlation_id()
        {
            var message = new TestMessage { FirstId = Guid.NewGuid(), SecondId = Guid.NewGuid() };
            var def1 = MessageDefinition.Create<TestMessage>(m => m.FirstId);
            var def2 = MessageDefinition.Create<TestMessage>(m => m.SecondId);

            Assert.That(def1.GetCorrelationId(message), Is.EqualTo(message.FirstId), "It should use FirstId");
            Assert.That(def2.GetCorrelationId(message), Is.EqualTo(message.SecondId), "It should use SecondId");
        }
开发者ID:Suremaker,项目名称:SLAMonitor,代码行数:9,代码来源:MessageDefinitionTests.cs

示例12: WaitsForFirstMessage

        public async Task WaitsForFirstMessage() {
            var task = this.EventManager.WaitFor<TestMessage, SecondTestMessage>();
            var testMessage = new TestMessage();
            this.MessageBus.Send(testMessage);
            this.React();

            var result = await task;

            Assert.AreEqual(result, testMessage);
        }
开发者ID:ttsvetanov,项目名称:Eventing,代码行数:10,代码来源:EventManagerTests.cs

示例13: Publish_calls_the_method_on_subscriber

        public void Publish_calls_the_method_on_subscriber()
        {
            var simplePublishWay = new SimpleDispatcher();
            var message = new TestMessage();
            var handler = new TestHandler();

            simplePublishWay.Invoke(message, handler);

            Assert.That(handler.TestMessage, Is.SameAs(message));
        }
开发者ID:solyutor,项目名称:Solyutor.EventPublisher,代码行数:10,代码来源:SimplePublishWayTest.cs

示例14: SerialiseAndDeserialiseMessage

        public void SerialiseAndDeserialiseMessage()
        {
            var componentUnderTest = new JsonMessageSerialiser();

             var message = new TestMessage();
             var serialisedMessage = componentUnderTest.Serialise(message);
             var deserialisedMessage = componentUnderTest.Deserialise(serialisedMessage, typeof(TestMessage));

             Assert.That(deserialisedMessage, Is.Not.Null);
        }
开发者ID:hariharanpalani,项目名称:service-bus,代码行数:10,代码来源:JsonMessageSerialiserShould.cs

示例15: ExpectExceptionForUnreadableData

		public void ExpectExceptionForUnreadableData()
		{
			var message = new TestMessage { content = "This message cannot be resolved!", ID = 0 };
			var memoryStream = new MemoryStream(new byte[64]);
			var binaryWriter = new BinaryWriter(memoryStream);
			binaryWriter.Write(BinaryDataExtensions.ToByteArray(message));
			memoryStream.Position = 0;
			var binaryReader = new BinaryReader(memoryStream);
			Assert.Throws<TypeLoadException>(() => binaryReader.Create());
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:BinaryDataExtensionsTests.cs


注:本文中的TestMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。