コード例 #1
0
ファイル: MiscTests.cs プロジェクト: sillsdev/WorldPad
		//[Ignore("Has problems with new restore database approach")]
		public void Transactions()
		{
			CheckDisposed();

			if (!m_fdoCache.DatabaseAccessor.IsTransactionOpen())
				m_fdoCache.DatabaseAccessor.BeginTrans();

			StStyle newStyle = new StStyle();
			m_fdoCache.LangProject.StylesOC.Add(newStyle);

			int newStyleHvo = newStyle.Hvo;
			m_fdoCache.DatabaseAccessor.RollbackTrans();

			// A simple rollback will not clear the object from the cache,
			// so do it here.
			m_fdoCache.VwCacheDaAccessor.ClearInfoAbout(newStyleHvo, VwClearInfoAction.kciaRemoveAllObjectInfo);

			if (newStyle.IsValidObject())
			{
				// Should not get here, as the create call should throw the exception.
				// Just in case, however, delete the new object.
				newStyle.DeleteUnderlyingObject();
				Assert.Fail("Object is still valid.");
			}
		}