public void SerializeAndDeserializeTaskAndAwaitableSuccessfully()
        {
            var storage = new InMemoryStorageEngine();
            var os      = ObjectStore2.New(storage);

            var awaitable = new CAwaitable2 <string>();
            var wrapper   = new Wrapper();

            os.Roots.Entangle(awaitable);
            os.Roots.Entangle(wrapper);

            _ = wrapper.Do(awaitable);

            os.Persist();

            os        = ObjectStore2.Load(storage);
            awaitable = os.Roots.Find <CAwaitable2 <string> >();
            wrapper   = os.Roots.Find <Wrapper>();

            wrapper.State.ShouldBeNull();
            awaitable.SignalCompletion("hello world");

            wrapper.State.ShouldBe("hello world");
        }
Example #2
0
 private CTask2(CAwaitable2 awaitable) => Awaitable = awaitable;
 public async CTask2 Do(CAwaitable2 <string> awaitable) => State = await awaitable;