Beispiel #1
0
        public void Data_is_immutable()
        {
            var ss = new SomeStruct { Id = 1234, Comment = "my comment" };

            var funnel = Funnel.GetBy(MyTag.Tag1);
            funnel.Publish(ss);

            ss.Id = 4321;

            var funnel2 = Funnel.GetBy(MyTag.Tag1);
            var ss2 = funnel2.Get<SomeStruct>();

            Assert.That(ss2.Id, Is.EqualTo(1234));
        }
        public void Push_Read_Modify_Read()
        {
            var log = LogFile.New("funnels.log");
            var ioc = IoC.New(log);

            var funnels = FunnelsManager.New().Start();
            var funnels2 = FunnelsManager.New().Start();

            var resolver = FunnelsResolver.New(ioc);
            var shop = FunnelsShop.New(ioc, new FunnelsConfig());

            using (resolver.AsServiceAt(log, "net.tcp://localhost:1978/FunnelsHub"))
            using (shop.AsService(log))
            {
                resolver.RegisterShop(shop.GetInfo());

                {
                    var ss = new SomeStruct { Id = 1234, Comment = "my comment" };
                    var funnel = funnels.GetFunnelBy(MyTag.Tag1);
                    funnel.Publish(ss);
                }

                Thread.Sleep(200);

                {
                    var funnel = funnels2.GetFunnelBy(MyTag.Tag1);
                    var ss = funnel.Get<SomeStruct>();

                    Assert.That(ss, Is.Not.Null);
                    Assert.That(ss.Id, Is.EqualTo(1234));

                    ss.Id = 4321;
                    funnel.Publish(ss);
                }

                Thread.Sleep(200);

                {
                    var funnel = funnels.GetFunnelBy(MyTag.Tag1);
                    var ss = funnel.Get<SomeStruct>();

                    Assert.That(ss.Id, Is.EqualTo(4321));
                }
            }

            funnels.Stop();
            funnels2.Stop();
        }
Beispiel #3
0
        public void Publish_is_data_distribution()
        {
            {
                var ss = new SomeStruct { Id = 1234, Comment = "my comment" };

                var funnel = Funnel.GetBy(MyTag.Tag1);
                funnel.Publish(ss);
            }

            {
                var funnel = Funnel.GetBy(MyTag.Tag1);
                var ss = funnel.Get<SomeStruct>();

                Assert.That(ss.Id, Is.EqualTo(1234));
            }
        }
Beispiel #4
0
        public void It_should_just_work()
        {
            var ss = new SomeStruct {Id = 1234, Comment = "my comment"};

            var funnel = Funnel.GetBy(MyTag.Tag1);
            funnel.Publish(ss);

            var funnel2 = Funnel.GetBy(MyTag.Tag1);
            var ss2 = funnel2.Get<SomeStruct>();

            Assert.That(ss2, Is.Not.SameAs(ss));
            Assert.That(ss2.Id, Is.EqualTo(ss.Id));
            Assert.That(ss2.Comment, Is.EqualTo(ss.Comment));

            var ss3 = funnel2.Get<SomeStruct>();
            Assert.That(ss3, Is.Not.SameAs(ss2));
        }