Ejemplo n.º 1
0
        public void CanCreateDerivedType()
        {
            RailFactory <A> factory = new RailFactory <A>(typeof(B));
            A createdObj            = factory.Create();

            Assert.True(createdObj is B);
        }
Ejemplo n.º 2
0
        public void CanCreateTypeWithParameter()
        {
            C arg = new C
            {
                i = 42
            };

            RailFactory <A> factory = new RailFactory <A>(typeof(D), new object[] { arg });
            A createdObj            = factory.Create();

            Assert.True(createdObj is D);
            D createdD = createdObj as D;

            Assert.Same(arg, createdD.MyC);
        }