コード例 #1
0
 public void ShouldBeValid()
 {
     Locate locate = new Locate();
     Assert.True(locate.NoErrors, "locate has errors");
 }
コード例 #2
0
        public void ShouldAddRecordToLocate()
        {
            int numberOfObjectsWritten = 0;

            IUnitOfWork uow = facade.GetUnitOfWork();

            Locate loc = new Locate { part = "503-831", descript = "whizzer", location = "bin4" };

            try
            {
                if (loc.NoErrors)
                {
                    uow.LocateRepo.Insert(loc);
                    uow.Commit();
                }
                else
                {
                    throw new Exception("Location entity instance contained errors");
                }
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                numberOfObjectsWritten = uow.NumberOfObjectsWritten;

                facade.ReturnUnitOfWork();

                Assert.AreEqual(1, numberOfObjectsWritten);
            }
        }