예제 #1
0
        public void InsertMerchatListTest()
        {
            var a = uow_CUT.GetType();
            var b = a.GetField("merchantList_repository",
                               System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            var c = b.GetValue(uow_CUT);

            IRepository <MERCHANT_LIST_SQL> mlRepo = (IRepository <MERCHANT_LIST_SQL>)uow_CUT.GetType().GetField("merchantList_repository",
                                                                                                                 System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                                                     .GetValue(uow_CUT);

            int merchantsBefore   = mlRepo.GetALL().Count();
            int merchantsExpected = merchantsBefore + merchantsToInsert.Count();

            uow_CUT.InsertMerchatList(merchantsToInsert);

            int merchantsAfter = mlRepo.GetALL().Count();

            Assert.AreEqual(merchantsExpected, merchantsAfter);
            Assert.AreNotEqual(merchantsBefore, merchantsAfter);

            mlRepo.DeleteByList(merchantsToInsert);
            mlRepo.Save();
        }