コード例 #1
0
        public void DevicesProjection_is_created()
        {
            var p = new EventStoreProjectionParameters {
                Name = "ProjectionDevices",
                SourceStreamNames = new List <string> {
                    "$ce-Locations"
                },
                DestinationStreamName = "cp-Devices",
                EventsToInclude       = new Type[] { typeof(LocationOpened) }
            };
            var proj = EventStoreProjectionBuilder.BuildProjectionDefinition(p);

            string expected = "fromStreams('$ce-Locations').when({LocationOpened: function(s,e){linkTo('cp-Devices', e);return s;}})";

            Assert.That(proj.Name, Is.EqualTo("ProjectionDevices"));
            Assert.That(proj.Source, Is.EqualTo(expected));
        }
        static void Add(EventStoreProjectionParameters par, Dictionary <string, string> data)
        {
            var p = EventStoreProjectionBuilder.BuildProjectionDefinition(par);

            data.Add(p.Name, p.Source);
        }