Пример #1
0
        public void CallInitializer()
        {
            dynamic factory = _serviceProvider.GetService<IShapeFactory>();
            var bar = new { One = 1, Two = "two" };
            var foo = factory.Foo(bar);

            Assert.Equal(1, foo.One);
            Assert.Equal("two", foo.Two);
        }
Пример #2
0
        public void CallInitializerWithBaseType()
        {
            dynamic factory = _serviceProvider.GetService<IShapeFactory>();
            var bar = new { One = 1, Two = "two" };
            var foo = factory.Foo(typeof(MyShape), bar);

            Assert.IsType(typeof(MyShape), foo);
            Assert.Equal(1, foo.One);
            Assert.Equal("two", foo.Two);
        }