当前位置: 首页>>代码示例>>C#>>正文


C# TestRepository.Update方法代码示例

本文整理汇总了C#中TestRepository.Update方法的典型用法代码示例。如果您正苦于以下问题:C# TestRepository.Update方法的具体用法?C# TestRepository.Update怎么用?C# TestRepository.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestRepository的用法示例。


在下文中一共展示了TestRepository.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSuccess

		public virtual void TestSuccess()
		{
			// Manually force a delta of an object so we reuse it later.
			//
			TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);
			PackHeader(pack, 2);
			pack.Write((Constants.OBJ_BLOB) << 4 | 1);
			Deflate(pack, new byte[] { (byte)('a') });
			pack.Write((Constants.OBJ_REF_DELTA) << 4 | 4);
			a.CopyRawTo(pack);
			Deflate(pack, new byte[] { unchecked((int)(0x1)), unchecked((int)(0x1)), unchecked(
				(int)(0x1)), (byte)('b') });
			Digest(pack);
			OpenPack(pack);
			// Verify the only storage of b is our packed delta above.
			//
			ObjectDirectory od = (ObjectDirectory)src.ObjectDatabase;
			NUnit.Framework.Assert.IsTrue(src.HasObject(b), "has b");
			NUnit.Framework.Assert.IsFalse(od.FileFor(b).Exists(), "b not loose");
			// Now use b but in a different commit than what is hidden.
			//
			TestRepository s = new TestRepository<Repository>(src);
			RevCommit N = s.Commit().Parent(B).Add("q", b).Create();
			s.Update(R_MASTER, N);
			// Push this new content to the remote, doing strict validation.
			//
			TransportLocal t = new _TransportLocal_210(this, src, UriOf(dst), dst.Directory);
			RemoteRefUpdate u = new RemoteRefUpdate(src, R_MASTER, R_MASTER, false, null, null
				);
			//
			//
			// src name
			// dst name
			// do not force update
			// local tracking branch
			// expected id
			PushResult r;
			try
			{
				t.SetPushThin(true);
				r = t.Push(PM, Sharpen.Collections.Singleton(u));
			}
			finally
			{
				t.Close();
			}
			NUnit.Framework.Assert.IsNotNull(r, "have result");
			NUnit.Framework.Assert.IsNull(r.GetAdvertisedRef(R_PRIVATE), "private not advertised"
				);
			NUnit.Framework.Assert.AreEqual(RemoteRefUpdate.Status.OK, u.GetStatus(), "master updated"
				);
			NUnit.Framework.Assert.AreEqual(N, dst.Resolve(R_MASTER));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:53,代码来源:ReceivePackAdvertiseRefsHookTest.cs

示例2: SetUp

		public override void SetUp()
		{
			base.SetUp();
			src = CreateBareRepository();
			dst = CreateBareRepository();
			// Fill dst with a some common history.
			//
			TestRepository d = new TestRepository<Repository>(dst);
			a = d.Blob("a");
			A = d.Commit(d.Tree(d.File("a", a)));
			B = d.Commit().Parent(A).Create();
			d.Update(R_MASTER, B);
			// Clone from dst into src
			//
			NGit.Transport.Transport t = NGit.Transport.Transport.Open(src, UriOf(dst));
			try
			{
				t.Fetch(PM, Collections.Singleton(new RefSpec("+refs/*:refs/*")));
				NUnit.Framework.Assert.AreEqual(B, src.Resolve(R_MASTER));
			}
			finally
			{
				t.Close();
			}
			// Now put private stuff into dst.
			//
			b = d.Blob("b");
			P = d.Commit(d.Tree(d.File("b", b)), A);
			d.Update(R_PRIVATE, P);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:30,代码来源:ReceivePackAdvertiseRefsHookTest.cs

示例3: CanUpdateExisting

        public void CanUpdateExisting()
        {
            // Arrange
            var entity = TestData[1];
            var repo = new TestRepository( Session );

            // Act
            entity.PropOne = "Hello World";
            repo.Update( entity );

            // Assert
            var fromDb = Session.Get<TestEntity>( entity.Id );
            Assert.AreEqual( entity.PropOne, fromDb.PropOne );
        }
开发者ID:TheSylence,项目名称:GSD,代码行数:14,代码来源:RepositoryTests.cs


注:本文中的TestRepository.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。