コード例 #1
0
ファイル: MessageTests.cs プロジェクト: w1r2p1/Nautilus
        internal void Equal_WithDifferentMessagesOfTheSameContent_CanEquateById()
        {
            // Arrange
            var message1 = new TestMessage(Guid.NewGuid(), StubZonedDateTime.UnixEpoch());
            var message2 = new TestMessage(Guid.NewGuid(), StubZonedDateTime.UnixEpoch());

            // Act
            // Assert
            Assert.NotNull(message1);
            Assert.False(message1 == message2);
            Assert.True(message1 != message2);
            Assert.True(message1.Equals(message1));
            Assert.False(message1.Equals(message2));
        }
コード例 #2
0
        public void message_queue_pub_single()
        {
            bool wasEqual = false;
            var  msg      = new TestMessage {
                Content = 1234
            };

            var mq = new MessageQueue();

            mq.Bus.Sub <TestMessage>((in TestMessage pub) =>
            {
                wasEqual = msg.Equals(pub);
            });
コード例 #3
0
        public void message_bag_modify()
        {
            var bag = new MessageBag <TestMessage>();

            var msg = new TestMessage {
                Content = 1234
            };

            bag.Enqueue(msg);

            Assert.True(bag.Dequeue(out var fromBag));
            Assert.True(msg.Equals(fromBag));
        }