예제 #1
0
        public void GivenNoValuesThenCausationIsSetToEmptyAndANewCorrelationIsGenerated()
        {
            var message = new SerializableMessage();

            Assert.Equal(Guid.Empty, message.CausationId);
            Assert.NotEqual(Guid.Empty, message.CorrelationId);
        }
        public void GivenTwoEntitiesWithTheSameIdsButDifferentTypesThenAPositiveResponseIsReturned()
        {
            var first  = new SerializableMessage();
            var second = new SerializableEntity <Guid>(first.Id);

            Assert.True(first != second);
            Assert.True(second != first);
        }
        public void GivenTwoMessagesWithDifferentIdsAndTheSameTypeThenAPositiveResponseIsReturned()
        {
            var first  = new SerializableMessage();
            var second = new SerializableMessage();

            Assert.True(first != second);
            Assert.True(second != first);
        }
        public void GivenTwoMessagesWithTheSameIdAndTypeThenANegativeResponseIsReturned()
        {
            var first = new SerializableMessage();
            SerializableMessage second = first.Clone();

            Assert.False(first != second);
            Assert.False(second != first);
        }
예제 #5
0
        public void GivenAnInstanceBasedOnAnInstanceThenTheCorrelationPropagatedAndTheCausationIsSetToTheIdOfTheOriginal()
        {
            var expected = new SerializableMessage();
            var message  = new SerializableMessage(context: expected);

            Assert.Equal(expected.Id, message.CausationId);
            Assert.Equal(expected.CorrelationId, message.CorrelationId);
        }
예제 #6
0
        public void GivenTwoEntitiesWithTheSameIdsButDifferentTypesThenANegativeResponseIsReturned()
        {
            var first  = new SerializableMessage();
            var second = new SerializableEntity <Guid>(first.Id);

            Assert.False(first == second);
            Assert.False(first.Equals(second));
            Assert.False(second == first);
        }
예제 #7
0
        public void GivenTwoMessagesWithTheSameIdAndTypeThenAPositiveResponseIsReturned()
        {
            var first = new SerializableMessage();
            SerializableMessage second = first.Clone();

            Assert.Equal(first, second);
            Assert.True(first == second);
            Assert.True(first.Equals(second));
            Assert.True(second == first);
        }
예제 #8
0
        public void GivenTwoMessagesWithDifferentIdsAndTheSameTypeThenANegativeResponseIsReturned()
        {
            var first  = new SerializableMessage();
            var second = new SerializableMessage();

            Assert.NotEqual(first, second);
            Assert.False(first == second);
            Assert.False(first.Equals(second));
            Assert.False(second == first);
        }
예제 #9
0
        public void GivenAnInstanceThenAllPropertiesAreSerialized()
        {
            var original = new SerializableMessage();
            SerializableMessage deserialized = original.Clone();

            Assert.Equal(original, deserialized);
            Assert.NotSame(original, deserialized);

            Assert.Equal(original.CausationId, deserialized.CausationId);
            Assert.Equal(original.CorrelationId, deserialized.CorrelationId);
            Assert.Equal(original.Id, deserialized.Id);
            Assert.Equal(original.TimeStamp, deserialized.TimeStamp);

            Assert.Equal(original.GetHashCode(), deserialized.GetHashCode());
        }