Esempio n. 1
0
        public async Task CreateAndClearAsyncCachedObjects()
        {
            sut.BindAsyncFactory <AsyncCreatable>().AsSingleton();
            var(clear, fact) = sut.Get <(Action, Func <int, Func <string, Task <AsyncCreatable> > >)>();
            var ret = await fact(1)("Hello World");

            var ret2 = await fact(10)("aaa");

            Assert.Equal(1, ret2.A);
            Assert.Equal("Hello World", ret2.B);
            Assert.Equal(ret, ret2);

            clear();

            var ret3 = await fact(200)("new");

            Assert.NotEqual(ret, ret3);
            Assert.Equal(200, ret3.A);
            Assert.Equal("new", ret3.B);
        }