Beispiel #1
0
        public PerformanceTests()
        {
            _model = TypeModel.Create();
            _model.Add(typeof(Event), true);
            _stream = new MemoryStream();

            for (var i = 0; i < 1000 * 1000; i++)
            {
                var id = Guid.NewGuid();
                var item = new OrderPlacedEvent(id,
                    "Ordered by customer number" + i.ToString(CultureInfo.InvariantCulture),
                    new[] { new OrderItem("Test product", i) });
                var shipment = new OrderShippedEvent(id, DateTime.Now);

                _model.SerializeWithLengthPrefix(_stream, item, typeof(Event), Prefix, 0);
                _model.SerializeWithLengthPrefix(_stream, shipment, typeof(Event), Prefix, 0);
            }
        }