Beispiel #1
0
        public void Cannot_Register_New_Element_For_Completed_Scope()
        {
            var target  = new NameScope();
            var element = new object();

            target.Register("foo", element);
            target.Complete();
            Assert.Throws <InvalidOperationException>(() => target.Register("bar", element));
        }
Beispiel #2
0
        public void FindAsync_Should_Return_Null_After_Scope_Completion()
        {
            var  scope    = new NameScope();
            var  element  = new object();
            bool finished = false;

            async void Find(string name)
            {
                Assert.Null(await scope.FindAsync(name));
                finished = true;
            }

            Find("foo");
            Assert.False(finished);
            scope.Register("bar", element);
            Assert.False(finished);
            scope.Complete();
            Assert.True(finished);
        }