Example #1
0
        public void ApplyUpdatesTheState()
        {
            var state  = "testdata";
            var target = new AggregateBuilder().WithCommand(state).Build();

            Assert.Equal("testdata", target.TestData);
        }
Example #2
0
        public void CanLoadNewAggregateToExactState()
        {
            var old    = new AggregateBuilder().WithCommand().Build();
            var loaded = new TestAggregate();

            loaded.Load(old.PendingEvents());
            Assert.Equal(old, loaded);
        }
Example #3
0
        public async Task AllEventsAreLoadedUpProperly()
        {
            var agg = new AggregateBuilder()
                      .WithAppend("1")
                      .WithAppend("2")
                      .WithAppend("3")
                      .WithCommand("*")
                      .Build();
            var harness = new RepoBuilder()
                          .WithAggregate(agg)
                          .Build();
            await harness.Save();

            var agg2 = await harness.Load(agg.Id);

            Assert.Equal(agg, agg2);
        }
Example #4
0
        public void ApplyIncrementsTheVersion()
        {
            var target = new AggregateBuilder().WithCommand().Build();

            Assert.Equal(1, target.Version);
        }