コード例 #1
0
 public void WhenUpdatingAnItem_ThenTheItemIsUpdated()
 {
     var item = new IdTest() { Identity = this.Item1.Identity, Value = 123, };
     this.UnitOfWork.Save(item);
     var updated = this.UnitOfWork.GetById(item.Identity);
     Assert.AreEqual(123, updated.Value);
 }
コード例 #2
0
        public void WhenUpdatingAnItem_ThenTheItemSaveResultIsUpdated()
        {
            var item = new IdTest() { Identity = this.Item1.Identity, Value = 123, };
            var result = this.UnitOfWork.Save(item);

            Assert.AreEqual(SaveResult.Updated, result);
        }
コード例 #3
0
        public void WhenUpdatingAnItem_ThenTheItemIsNotUpdatedInTheUnderlyingRepository()
        {
            var item = new IdTest() { Identity = this.Item1.Identity, Value = 123, };
            this.UnitOfWork.Save(item);

            var updated = this.Repository.GetById(item.Identity);
            Assert.AreNotEqual(123, updated.Value);
        }
コード例 #4
0
        public override void SetUp()
        {
            base.SetUp();
            this.Item1 = this.Repository.New();
            this.Item2 = this.Repository.New();
            this.Item3 = this.Repository.New();

            this.Item1.Value = 1;
            this.Item2.Value = 2;
            this.Item3.Value = 3;

            this.Repository.Save(this.Item1);
            this.Repository.Save(this.Item2);
            this.Repository.Save(this.Item3);
        }
コード例 #5
0
        public override void SetUp()
        {
            base.SetUp();
            this.Item1 = this.UnitOfWork.New();
            this.Item2 = this.UnitOfWork.New();
            this.Item3 = this.UnitOfWork.New();
            
            this.Item1.Value = 1;
            this.Item2.Value = 2;
            this.Item3.Value = 3;

            // add to underlying repository - initial data set
            this.Repository.Save(this.Item1);
            this.Repository.Save(this.Item2);
            this.Repository.Save(this.Item3);
        }