2using System.Threading.Tasks;
5using Microsoft.VisualStudio.TestTools.UnitTesting;
17 _testDIContext = TestDIContextFactory.CreateDefaultContext();
21 [TestCategory(
"SkipWhenLiveUnitTesting")]
28 var bo = dataPortal.
Create();
39 [TestCategory(
"SkipWhenLiveUnitTesting")]
43 string expected =
"A suitable constructor for type 'Csla.Test.DataPortal.EditableChild2' could not be located.";
51 Assert.AreEqual(e.
BusinessException.Message.Substring(0, expected.Length), expected);
60 RegisterProperty<EditableChild1>(c => c.Child);
72 using (BypassPropertyChecks)
76 BusinessRules.CheckRules();
82 using (BypassPropertyChecks)
84 LoadProperty(
ChildProperty, await childDataPortal.FetchChildAsync(1));
86 BusinessRules.CheckRules();
93 using (BypassPropertyChecks)
95 FieldManager.UpdateChildren(
this);
108 using (BypassPropertyChecks)
115 private Task Child_FetchAsync(
int id)
117 using (BypassPropertyChecks)
124 private void Child_Insert(
object parent)
126 using (BypassPropertyChecks)
128 throw new CustomException(
"Insert not allowed");
145 private Task Child_FetchAsync(
int id)
147 return Task.CompletedTask;
This is the base class from which most business objects will be derived.
This exception is returned for any errors occurring during the server-side DataPortal invocation.
Exception BusinessException
Gets the original server-side exception.
Maintains metadata about a property.
CustomException(string message)
void ChildInnerExceptionFlowsFromDataPortal()
static void ClassInitialize(TestContext context)
async Task ChildCreationExceptionFlowsFromDataPortalAsync()
override void Child_Create()
void DataPortal_Create([Inject] IChildDataPortal< EditableChild1 > childDataPortal)
async Task DataPortal_FetchAsync([Inject] IChildDataPortal< EditableChild2 > childDataPortal)
static readonly PropertyInfo< EditableChild1 > ChildProperty
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...
Task< object > FetchAsync(params object[] criteria)
Starts an asynchronous data portal operation to create a business object.
TransactionalTypes
Provides a list of possible transactional technologies to be used by the server-side DataPortal.
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Create
Create operation.