Exemple #1
0
        public async Task more_syntactic_sugar_comes_at_rescue()
        {
            var strangerStreams = new DomainBuilder()
                                  .PersistOn(() => _memory)
                                  .WithSnapshotsOn(() => new DefaultSnapshotStore(new InMemoryPersistence(new InMemoryPersistenceOptions())))
                                  .CreateAggregatesWith(() => new DefaultAggregateFactory())
                                  .Build();

            var scene = strangerStreams.Record("scene120");
            var el    = await scene.GetAsync <Mage>("11");

            el.Do(new Attack("demogorgon", Attack.AttackLevel.Kill));
            await scene.StreamAsync();

            var changes = await strangerStreams.OpenForRead("11").RecordAsync();

            Assert.Equal(1, changes.Length);
        }