9using System.Collections.Generic;
12using System.Diagnostics;
16using Microsoft.VisualStudio.TestTools.UnitTesting;
19using TestClass = NUnit.Framework.TestFixtureAttribute;
20using TestInitialize = NUnit.Framework.SetUpAttribute;
21using TestCleanup = NUnit.Framework.TearDownAttribute;
22using TestMethod = NUnit.Framework.TestAttribute;
28 public class CollectionTests
35 _testDIContext = TestDIContextFactory.CreateDefaultContext();
44 list.Add(childDataPortal.Create());
45 list.Add(childDataPortal.Create());
46 TestItem oldItem = childDataPortal.Create();
48 TestItem newItem = childDataPortal.Create();
50 Assert.AreEqual(3, list.Count,
"List should have 3 items");
51 Assert.AreEqual(newItem, list[2],
"Last item should be newItem");
52 Assert.AreEqual(
true, list.ContainsDeleted(oldItem),
"Deleted list should have old item");
78 Add(childDataPortal.FetchChild(123));
79 Add(childDataPortal.FetchChild(2));
80 Add(childDataPortal.FetchChild(13));
81 Add(childDataPortal.FetchChild(23));
82 Add(childDataPortal.FetchChild(3));
87 public class TestItem : BusinessBase<TestItem>
89 private static PropertyInfo<int> IdProperty = RegisterProperty<int>(c => c.Id);
92 get {
return GetProperty(IdProperty); }
93 set { SetProperty(IdProperty, value); }
98 return (Parent !=
null);
113 private void Child_Fetch(
int id)
115 LoadProperty(IdProperty,
id);
This is the base class from which most business collections or lists will be derived.
static void ClassInitialize(TestContext context)
void RootListGetRuleDescriptions()
string[] GetRuleDescriptions()
override void Child_Create()
Type to carry context information for DI in unit tests
Interface defining the members of the child data portal type.
Interface defining the members of the data portal type.
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
@ Serializable
Prevents updating or inserting until the transaction is complete.