Click here to Skip to main content
15,896,912 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 44K   425   45  
Host your Domain Models "Out Of The Box" + No storage or schema needed + Transactions on Domain Models + Validation
using NUnit.Framework;
using Technewlogic.ObjectLounge.Framework.Validation;
using System;
using Technewlogic.ObjectLounge.Framework.Proxy;
using System.Collections.Generic;
using Technewlogic.ObjectLounge.Framework.Transactions;

namespace Technewlogic.ObjectLounge.Test.ValidationTests
{
	class DummyProxy : IProxy
	{
		#region IUnitOfWorkConcern Members

		public Technewlogic.ObjectLounge.Framework.BaseConcerns.NavigationConcern NavigationConcern
		{
			get { throw new NotImplementedException(); }
		}

		public Technewlogic.ObjectLounge.Framework.BaseConcerns.KeyManagementConcern KeyManagementConcern
		{
			get { throw new NotImplementedException(); }
		}

		public Technewlogic.ObjectLounge.Framework.BaseConcerns.ChangeTrackingConcern ChangeTrackingConcern
		{
			get { throw new NotImplementedException(); }
		}

		#endregion

		#region IValidationConcern Members

		public ValidationConcern ValidationConcern
		{
			get { throw new NotImplementedException(); }
		}

		#endregion

		#region IProxy Members

		public void Initialize()
		{
		}

		#endregion

		#region ITransactionCollectionHandler Members

		public void ExecuteListOperation(Action del, string propertyName, object newValue, object oldValue)
		{
			throw new NotImplementedException();
		}

		public bool TryGetCommittedValue(string propertyName, out object value)
		{
			throw new NotImplementedException();
		}

		public void RegisterRollbackAction(string propertyName, Action<object> restoreValueMethod)
		{
			throw new NotImplementedException();
		}

		#endregion
	}

    [TestFixture]
	public class ValidationTransactionServiceTest
	{
		[TestFixtureSetUp]
		public void TestFixtureSetUp()
		{
		}

		[SetUp]
		public void SetUp()
		{
		}

		[Test]
		public void AddBrokenRules()
		{
			throw new NotImplementedException();

			//ValidationTransactionService vs = new ValidationTransactionService();

			//IProxy source1 = new DummyProxy();
			//IEnumerable<BrokenRule> brokenRules1 = new List<BrokenRule>()
			//{
			//    new BrokenRule("Rule1", "Error1"),
			//    new BrokenRule("Rule2", "Error2"),
			//    new BrokenRule("Rule3", "Error3")
			//};

			//IProxy source2 = new DummyProxy();
			//IEnumerable<BrokenRule> brokenRules2 = new List<BrokenRule>()
			//{
			//    new BrokenRule("Rule4", "Error4")
			//};

			//vs.MarkOrTrigger(source1, brokenRules1);
			//vs.MarkOrTrigger(source2, brokenRules2);

			//Assert.AreEqual(2, vs.InvalidObjects.Count);
			//Assert.AreEqual(brokenRules1, vs.InvalidObjects[source1]);
			//Assert.AreEqual(brokenRules2, vs.InvalidObjects[source2]);
		}

		[Test]
		public void RemoveBrokenRules()
		{
			throw new NotImplementedException();

			//ValidationTransactionService vs = new ValidationTransactionService();

			//IProxy source1 = new DummyProxy();
			//IEnumerable<BrokenRule> brokenRules1 = new List<BrokenRule>()
			//{
			//    new BrokenRule("Rule1", "Error1"),
			//    new BrokenRule("Rule2", "Error2"),
			//    new BrokenRule("Rule3", "Error3")
			//};

			//IProxy source2 = new DummyProxy();
			//IEnumerable<BrokenRule> brokenRules2 = new List<BrokenRule>()
			//{
			//    new BrokenRule("Rule4", "Error4"),
			//};

			//vs.MarkOrTrigger(source1, brokenRules1);
			//vs.MarkOrTrigger(source2, brokenRules2);

			//vs.MarkOrTrigger(source1, new BrokenRule[] { });

			//Assert.AreEqual(1, vs.InvalidObjects.Count);
			//Assert.AreEqual(brokenRules2, vs.InvalidObjects[source2]);
			//try
			//{
			//    Assert.AreEqual(brokenRules1, vs.InvalidObjects[source1]);
			//    Assert.Fail("There should be no entry here!");
			//}
			//catch (KeyNotFoundException)
			//{
			//}
		}
	}
}

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