예제 #1
0
        public void ShouldContructObjectWithParameterShort()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1", "123" }
            };

            var myObject = new Instantiator().Bind <My <short> >(dic);

            Assert.AreEqual(My.Create((Int16)123), myObject);
        }
예제 #2
0
        public void ShouldContructObjectWithParameterChar()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1", "a" }
            };

            var myObject = new Instantiator().Bind <My <char> >(dic);

            Assert.AreEqual(My.Create('a'), myObject);
        }
예제 #3
0
        public void ShouldContructObjectWithParameterBoolean()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1", "true" }
            };

            var myObject = new Instantiator().Bind <My <bool> >(dic);

            Assert.AreEqual(My.Create(true), myObject);
        }
예제 #4
0
        public void ShouldContructObjectWithParameterEnumFromString()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1", "Asdrubal" }
            };

            var myObject = new Instantiator().Bind <My <E> >(dic);

            Assert.AreEqual(My.Create(E.Asdrubal), myObject);
        }
예제 #5
0
        public void ShouldContructObjectWithNonPrimitiveParameter()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1.f1", "asdf" }
            };

            var myObject = new Instantiator().Bind <My <My <string> > >(dic);

            Assert.AreEqual(My.Create(My.Create("asdf")), myObject);
        }
예제 #6
0
        public void ShouldContructObjectWithParameterDouble()
        {
            var dic = new Dictionary <string, string>
            {
                { "f1", "99.12345" }
            };

            var myObject = new Instantiator().Bind <My <double> >(dic);

            Assert.AreEqual(My.Create(99.12345), myObject);
        }