private async Task<IEnumerable<IAggregateEvent>> MakeExpectedChanges(CounterStats expected)
        {
            var counter = new Sample.Counter(AggregateId, new Sample.CounterState());

            for (var i = 0; i < expected.NumberOfIncrements; ++i)
            {
                counter.Increment();
            }

            for (var i = 0; i < expected.NumberOfMultiplications; ++i)
            {
                counter.Multiply(1);
            }

            for (var i = 0; i < expected.NumberOfResets; ++i)
            {
                counter.Reset();
            }
            await this.eventStore.Append(AggregateId, 0, counter.Changes);

            return counter.Changes;
        }
Beispiel #2
0
        private async Task <IEnumerable <IAggregateEvent> > MakeExpectedChanges(CounterStats expected)
        {
            var counter = new Sample.Counter(AggregateId, new Sample.CounterState());

            for (var i = 0; i < expected.NumberOfIncrements; ++i)
            {
                counter.Increment();
            }

            for (var i = 0; i < expected.NumberOfMultiplications; ++i)
            {
                counter.Multiply(1);
            }

            for (var i = 0; i < expected.NumberOfResets; ++i)
            {
                counter.Reset();
            }
            await this.eventStore.Append(AggregateId, 0, counter.Changes);

            return(counter.Changes);
        }
 /// <summary>
 /// Compares counter stats against the expected values
 /// </summary>
 /// <param name="query">query</param>
 /// <param name="expected">string in the form of {incremented}:{multiplied}:{reseted}</param>
 private void AssertStats(CounterStats actual, CounterStats expected)
 {
     Assert.That(actual.NumberOfIncrements, Is.EqualTo(expected.NumberOfIncrements));
     Assert.That(actual.NumberOfMultiplications, Is.EqualTo(expected.NumberOfMultiplications));
     Assert.That(actual.NumberOfResets, Is.EqualTo(expected.NumberOfResets));
 }
Beispiel #4
0
 /// <summary>
 /// Compares counter stats against the expected values
 /// </summary>
 /// <param name="query">query</param>
 /// <param name="expected">string in the form of {incremented}:{multiplied}:{reseted}</param>
 private void AssertStats(CounterStats actual, CounterStats expected)
 {
     Assert.That(actual.NumberOfIncrements, Is.EqualTo(expected.NumberOfIncrements));
     Assert.That(actual.NumberOfMultiplications, Is.EqualTo(expected.NumberOfMultiplications));
     Assert.That(actual.NumberOfResets, Is.EqualTo(expected.NumberOfResets));
 }