Click here to Skip to main content
15,891,864 members
Articles / Programming Languages / C#

ObjectLounge - An Object-Oriented Database Framework

Rate me:
Please Sign up or sign in to vote.
4.07/5 (8 votes)
30 Jul 2009LGPL310 min read 43.9K   425   45  
Host your Domain Models "Out Of The Box" + No storage or schema needed + Transactions on Domain Models + Validation
/*
 * Wird jetzt alles in General Tests gemacht
 * 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Technewlogic.Stasy.Framework;
using Technewlogic.Stasy.Test.Model;
using Technewlogic.Stasy.Framework.Proxy;

namespace Technewlogic.Stasy.Test.EntityCollection
{
	[TestFixture]
	public class UpdateHandling
	{
		[TestFixtureSetUp]
		public void TestFixtureSetUp()
		{
		}

		[SetUp]
		public void SetUp()
		{
		}

		// Mit dem Proxy sollen Property-Änderungen IMMER getrackt werden.
		//[Test]
		//public void IgnorePropertyChangesForInvalidBO()
		//{
		//    var generator = new Generator(new[] { typeof(NumberWrapper) });
		//    var testEntities = new List<NumberWrapper>();

		//    var num = generator.CreateProxy(typeof(NumberWrapper)) as NumberWrapper;
		//    num.Number = 1;
		//    testEntities.Add(num);

		//    var testCollection = new Technewlogic.Stasy.Framework.EntityCollection(
		//        new EntityContextManager(),
		//        testEntities.Cast<IProxy>(),
		//        typeof(NumberWrapper));

		//    var cts = testCollection.GetState(num as IProxy);
		//    Assert.AreEqual(SynchronizationOperation.Nothing, cts.SynchronizationOperation);

		//    num.Number = 999;
		//    Assert.AreEqual(SynchronizationOperation.Nothing, cts.SynchronizationOperation);

		//    num.Number = 123;
		//    Assert.AreEqual(SynchronizationOperation.Nothing, cts.SynchronizationOperation);
		//}

		[Test]
		public void HandlePropertyChangesForValidBO()
		{
			var generator = new Generator(new[] { typeof(OrderType) });
			var orderTypes = new List<OrderType>();

			var myOrderType = generator.CreateProxy(typeof(OrderType)) as OrderType;
			myOrderType.Name = "MyOrderType";
			myOrderType.Priority = 123;
			orderTypes.Add(myOrderType);

			var testCollection = new Technewlogic.Stasy.Framework.EntityCollection(
				new EntityContextManager(),
				orderTypes.Cast<IProxy>(),
				typeof(OrderType));

			var cts = testCollection.GetState(myOrderType as IProxy);
			Assert.AreEqual(SynchronizationOperation.Nothing, cts.SynchronizationOperation);

			myOrderType.Priority = 999;
			Assert.AreEqual(SynchronizationOperation.Updated, cts.SynchronizationOperation);

			myOrderType.Priority = 123;
			Assert.AreEqual(SynchronizationOperation.Updated, cts.SynchronizationOperation);
		}
	}
}
*/

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) www.technewlogic.de
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions