CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ChildInterfaceTests.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ChildInterfaceTests.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Text;
11
12#if !NUNIT
13using Microsoft.VisualStudio.TestTools.UnitTesting;
14
15#else
16using NUnit.Framework;
17using TestClass = NUnit.Framework.TestFixtureAttribute;
18using TestInitialize = NUnit.Framework.SetUpAttribute;
19using TestCleanup = NUnit.Framework.TearDownAttribute;
20using TestMethod = NUnit.Framework.TestAttribute;
21#endif
22
24{
25 [TestClass]
27 {
28 [TestMethod]
29 public void AddItems()
30 {
31 ItemList list = new ItemList();
32 list.Add(new Item1());
33 list.Add(new Item2());
34
35 Assert.IsTrue(list[0] is Item1, "First element should be Item1");
36 Assert.IsTrue(list[1] is Item2, "Second element should be Item2");
37 }
38 }
39
40 public interface IItem : Csla.Core.IEditableBusinessObject
41 { }
42
44 public class Item1 : Csla.BusinessBase<Item1>, IItem
45 {
46 public Item1()
47 {
48 MarkAsChild();
49 }
50
51 protected override object GetIdValue()
52 {
53 return 0;
54 }
55 }
56
58 public class Item2 : Csla.BusinessBase<Item2>, IItem
59 {
60 public Item2()
61 {
62 MarkAsChild();
63 }
64
65 protected override object GetIdValue()
66 {
67 return 0;
68 }
69 }
70
72 public class ItemList : Csla.BusinessBindingListBase<ItemList, IItem>
73 {
74 }
75}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
This is the base class from which most business collections or lists will be derived.
override object GetIdValue()
Override this method to return a unique identifying value for this object.
override object GetIdValue()
Override this method to return a unique identifying value for this object.
@ Serializable
Prevents updating or inserting until the transaction is complete.