2using System.Collections.Generic;
5using System.Threading.Tasks;
9using Microsoft.VisualStudio.TestTools.UnitTesting;
21 IServiceCollection serviceCollection =
new ServiceCollection();
23 serviceCollection.AddCsla();
25 var services = serviceCollection.BuildServiceProvider();
28 var classA = dataPortal.
Fetch();
29 var classB = classA.ChildB;
31 Assert.AreEqual(classA.DisposableClass.Id, classB.DisposableClass.Id,
"Ids must be the same");
32 Assert.IsFalse(classA.DisposableClass.IsDisposed,
"Object must not be disposed");
40 public Guid
Id {
get; } = Guid.NewGuid();
58 if (disposable.IsDisposed)
60 throw new ObjectDisposedException(nameof(disposable));
63 ChildB = classBDataPortal.Fetch();
65 if (disposable.IsDisposed)
67 throw new ObjectDisposedException(nameof(disposable));
75 public Guid
Id {
get;
set; }
82 if (disposable.IsDisposed)
84 throw new ObjectDisposedException(nameof(disposable));
This is the base class from which most business objects will be derived.
void Test_Scope_DoesNotDispose()
Interface defining the members of the data portal type.
object Fetch(params object[] criteria)
Called by a factory method in a business class to retrieve an object, which is loaded with values fro...