Exemplo n.º 1
0
        public void GivenAnInstanceWhenNoChangesArePendingThenAllPropertiesAreSerialized()
        {
            var expectedId = Guid.NewGuid();
            var original   = new SerializableEventCentricAggregateRoot(expectedId);

            original.MarkChangesAsCommitted();

            SerializableEventCentricAggregateRoot deserialized = original.Clone();

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

            Assert.Empty(deserialized.GetUncommittedChanges());
            Assert.Equal(expectedId, deserialized.Id);
            Assert.Equal(original.GetHashCode(), deserialized.GetHashCode());
        }
Exemplo n.º 2
0
        public void GivenAnInstanceWhenChangesArePendingThenAllPropertiesAreSerialized()
        {
            var expectedId = Guid.NewGuid();
            var value      = Guid.NewGuid();
            var context    = new SerializableMessage();
            var request    = new SetRequest(context, value);
            var original   = new SerializableEventCentricAggregateRoot(expectedId);

            original.Set(request);

            SerializableEventCentricAggregateRoot deserialized = original.Clone();

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

            Assert.Equal(original.GetUncommittedChanges(), deserialized.GetUncommittedChanges());
            Assert.Equal(expectedId, deserialized.Id);
            Assert.Equal(original.GetHashCode(), deserialized.GetHashCode());
        }