Пример #1
0
        public void TrnumsShouldOnlyHaveOneRow()
        {
            IUnitOfWork uow = facade.GetUnitOfWork();

            Trnum tr = new Trnum()
            {
                accpay = "0",
                accsys = 1,
                accrec = "0",
                bankbal = 0,
                bid = 0,
                bill = 0,
                brick = 0,
                clr = "0",
                credit = 0,
                customer = 0,
                dc = 0,
                employee = 0,
                house = 0,
                invoice = 0,
                job = 0,
                labacc = "0",
                md = "0",
                miscinc = "0",
                miscpmt = "0",
                check = 0,
                net = "Y",
                offset = "0",
                ooak_id = 1,
                order = 0,
                part = 0,
                program = "0",
                purch_ord = 0,
                quote = 0,
                retearn = "0",
                rquote = 0,
                rsalacc = "0",
                scale = 0,
                shipacc = "0",
                staxacc = "0",
                tax = 12.0123m,
                tran = 0,
                user = 0,
                vendor = 0,
                wsalacc = "0"
            };

            if(tr.NoErrors)
            {
                try
                {
                    uow.TrnumRepo.Insert(tr);

                    uow.Commit();

                    Assert.Fail();
                }
                catch (Exception e)
                {
                    Assert.Pass(e.Message.ToString());
                }
                finally
                {
                    facade.ReturnUnitOfWork();
                }

            }
            else
            {
                facade.ReturnUnitOfWork();

                Assert.False(tr.HasErrors);
            }
        }
 protected void Setup()
 {
     trnum = new Trnum();
     entityType = typeof(Trnum);
 }