예제 #1
0
        public void insert_then_get()
        {
            using (ServiceContainer _container = new ServiceContainer())
            {
                FooService fooService = _container.GetInstance <FooService>();

                Foo foo = new Foo()
                {
                    Name           = "Tom Chen",
                    Birthday_Title = DateTime.Now,
                    Address        = "Beijing"
                };

                FooDTO fooDTO = Mapper.Map <FooDTO>(foo);

                var baseObj = fooService.Insert(fooDTO);

                var aa = fooService.GetById(baseObj.Id);

                Assert.AreEqual(baseObj.Id, aa.Id);
                Assert.AreEqual(baseObj.BirthDayTitle, aa.BirthDayTitle);
                Assert.AreEqual(baseObj.Name, aa.Name);
                Assert.AreEqual(baseObj.Address_title, aa.Address_title);

                List <int> ids = new List <int>()
                {
                    1, 2, 3, 4, 5, 6
                };
                var bb = fooService.GetByIds(ids);
            }
        }