Exemplo n.º 1
0
        public void AddBeforeAndAfterSerializationAndDeserialization()
        {
            var storage = new InMemoryStorageEngine();
            var os      = ObjectStore.New(storage);

            var l = new CAppendOnlyList <int> {
                1
            };

            l.ToArray()[0].ShouldBe(1);

            os.Entangle(l);
            os.Persist();

            os = ObjectStore.Load(storage, true);
            l  = os.Resolve <CAppendOnlyList <int> >();

            l.ToArray().Length.ShouldBe(1);
            l.ToArray()[0].ShouldBe(1);

            l.Add(2);

            l.ToArray().Length.ShouldBe(2);
            l.ToArray()[0].ShouldBe(1);
            l.ToArray()[1].ShouldBe(2);

            os.Persist();
            os = ObjectStore.Load(storage, true);
            l  = os.Resolve <CAppendOnlyList <int> >();

            l.ToArray().Length.ShouldBe(2);
            l.ToArray()[0].ShouldBe(1);
            l.ToArray()[1].ShouldBe(2);
        }
        private void Handle(T next)
        {
            _toDeliver.Add(next);

            if (_awaitable != null)
            {
                SignalAwaitable();
            }
        }
Exemplo n.º 3
0
            private void Handle(T t)
            {
                _list.Add(t);

                if (_list.Count < _count || _completed)
                {
                    return;
                }

                Awaitable.SignalCompletion(_list);
                _completed = true;

                _inner?.Unsubscribe(this);
                _inner = null;
            }