Example #1
0
        public void CreateCustomContextDescriptor()
        {
            // act
            var descriptor = new CustomContextDescriptor(
                typeof(string), sp => "foo", ExecutionScope.Global);

            // assert
            Assert.Equal(typeof(string), descriptor.Key);
            Assert.Equal(typeof(string), descriptor.Type);
            Assert.Equal("foo", descriptor.Factory(null));
            Assert.Equal(ExecutionScope.Global, descriptor.Scope);
        }
Example #2
0
        public void CreateCustomContextDescriptorFactoryIsNull()
        {
            // act
            var descriptor = new CustomContextDescriptor(
                typeof(string), null, ExecutionScope.Global);

            // assert
            Assert.Equal(typeof(string), descriptor.Key);
            Assert.Equal(typeof(string), descriptor.Type);
            Assert.Null(descriptor.Factory);
            Assert.Equal(ExecutionScope.Global, descriptor.Scope);
        }