Exemplo n.º 1
0
        public void JsonGeneratorTest()
        {
            List <Message <SimpleObject> > stream1 = new List <Message <SimpleObject> >();
            List <Message <SimpleObject> > stream2 = new List <Message <SimpleObject> >();
            IStreamMetadata metadata1 = null;
            IStreamMetadata metadata2 = null;

            using (var p = Pipeline.Create("JsonGeneratorTest"))
            {
                var generator = JsonStore.Open(p, StoreName, InputPath);

                generator.OpenStream <SimpleObject>("Stream1").Do((d, e) => stream1.Add(new Message <SimpleObject>(d, e.OriginatingTime, e.Time, e.SourceId, e.SequenceId)));
                generator.OpenStream <SimpleObject>("Stream2").Do((d, e) => stream2.Add(new Message <SimpleObject>(d, e.OriginatingTime, e.Time, e.SourceId, e.SequenceId)));

                metadata1 = generator.GetMetadata("Stream1");
                ValidateMetadata(metadata1, "Stream1", 1, TypeName, PartitionName, PartitionPath, FirstTime, LastTime, FirstTime, LastTime, 388, 0, 2);

                metadata2 = generator.GetMetadata("Stream2");
                ValidateMetadata(metadata2, "Stream2", 2, TypeName, PartitionName, PartitionPath, FirstTime, LastTime, FirstTime, LastTime, 388, 0, 2);

                p.Run();
            }

            Assert.AreEqual(stream1.Count, 2);
            Assert.AreEqual(stream2.Count, 2);

            ValidateMessage(stream1[0], FirstTime, (data) => ValidateSimpleObject(data, Data));
            ValidateMessage(stream1[1], LastTime, (data) => ValidateSimpleObject(data, Data));
            ValidateMessage(stream2[0], FirstTime, (data) => ValidateSimpleObject(data, Data));
            ValidateMessage(stream2[1], LastTime, (data) => ValidateSimpleObject(data, Data));
        }
Exemplo n.º 2
0
 public void Setup()
 {
     _subject = new JsonStore();
     _subject.Open();
 }