Ejemplo n.º 1
0
        public void NormalToNullables()
        {
            var dinner = new Dinner { ChefId = 3 };
            var dinnerInput = new DinnerInput();

            dinnerInput.InjectFrom<NormalToNullables>(dinner);

            Assert.AreEqual(3, dinnerInput.ChefId);
            Assert.AreEqual(null, dinnerInput.Start);
            Assert.AreEqual(null, dinnerInput.CountryId);
        }
Ejemplo n.º 2
0
        public void EntitiesToIntsTest()
        {
            var dinner = new Dinner { Meals = new List<Meal> { new Meal { Id = 3 }, new Meal { Id = 7 } } };

            var dinnerInput = new DinnerInput();

            dinnerInput.InjectFrom<EntitiesToInts>(dinner);

            Assert.IsNotNull(dinnerInput.Meals);
            Assert.AreEqual(2, dinnerInput.Meals.Count());
            Assert.AreEqual(3, dinnerInput.Meals.First());
        }
Ejemplo n.º 3
0
        public void NormalToNullables()
        {
            var dinner = new Dinner {
                ChefId = 3
            };
            var dinnerInput = new DinnerInput();

            dinnerInput.InjectFrom <NormalToNullables>(dinner);

            Assert.AreEqual(3, dinnerInput.ChefId);
            Assert.AreEqual(null, dinnerInput.Start);
            Assert.AreEqual(null, dinnerInput.CountryId);
        }
        public void NormalToNullables()
        {
            var d = new Dinner {
                ChefId = 3
            };
            var di = new DinnerInput();

            di.InjectFrom <NormalToNullables>(d);

            Assert.AreEqual(3, di.ChefId);
            Assert.AreEqual(null, di.Date);
            Assert.AreEqual(null, di.CountryId);
        }
Ejemplo n.º 5
0
        public void EntitiesToIntsTest()
        {
            var dinner = new Dinner {
                Meals = new List <Meal> {
                    new Meal {
                        Id = 3
                    }, new Meal {
                        Id = 7
                    }
                }
            };

            var dinnerInput = new DinnerInput();

            dinnerInput.InjectFrom <EntitiesToInts>(dinner);

            Assert.IsNotNull(dinnerInput.Meals);
            Assert.AreEqual(2, dinnerInput.Meals.Count());
            Assert.AreEqual(3, dinnerInput.Meals.First());
        }