Example #1
0
        public void Verify_serialization_of_user_state()
        {
            AggregateTestSampleAggregate1 aggregate = new AggregateTestSampleAggregate1();

            aggregate.Init(new AggregateTestSampleAggregate1Id(1));
            aggregate.Touch();

            var snapshot = ((ISnapshottable)aggregate).GetSnapshot();

            var serialized = snapshot.ToJson();

            Assert.That(!serialized.Contains(" \"_t\" : \"AggregateTestSampleAggregate1Id\""));
        }
Example #2
0
        public void Verify_basic_snapshot_get_from_aggregate()
        {
            sut.Touch();
            string newSignature = Guid.NewGuid().ToString();

            sut.InternalState.SetSignature(newSignature);
            ApplyChanges();

            var snapshot = snapshottable.GetSnapshot();

            Assert.That(snapshot.SourceId, Is.EqualTo(sut.Id));
            Assert.That(snapshot.SchemaVersion, Is.EqualTo(newSignature));
            Assert.That(snapshot.SourceVersion, Is.EqualTo(1));
            Assert.That(snapshot.Payload, Is.InstanceOf <AggregateTestSampleAggregate1State>());
            var state = (AggregateTestSampleAggregate1State)snapshot.Payload;

            Assert.That(state.TouchCount, Is.EqualTo(1));
        }
 public void Can_route_to_internal_State()
 {
     sut.Touch();
     Assert.That(sut.InternalState.TouchCount, Is.EqualTo(1), "simple raise event did not get routed to the state");
 }