I am trying to code a unit test for one of our business objects but I had a question about the way I am calling the dataprotal create method. Here is a code snippets. Should I not use a criteria class? It passes in another business object that is inherited form the csla framework.
private class Criteria
public string RecordNo = string.Empty;
public Person LoggedInPerson;
public Criteria(string recordNo, Person LoggedInPerson)
this.RecordNo = recordNo;
LoggedInPerson = LoggedInPerson;
protected void DataPortal_Create(object criteria)
Criteria crit = (Criteria)criteria;
Which version of CSLA do you use?
For Csla 4.x you should use CriteriaBase as the base class for your Criteria object and use "managed properties" for properties/values.
This is to ensure that your code will work on all platforms and in N-tier deployment.
I am using the csla 3.x
Here is my code that I am using to test. what can I do better here? Does this look right?
///A test for DataPortal_Create
public void DataPortal_CreateTest()
//Cit expected = null; // TODO: Initialize to an appropriate value
Cit_Accessor target = new Cit_Accessor();
object criteria = new Cit_Accessor.Criteria(1, null);
//Assert.Inconclusive("A method that does not return a value cannot be verified.");
Well - anyway you are likely to do an integration test here and it depends on what you REALLY want to test.
Lets just look at what DataPortal_Create does.
And starting in CSLA 4.5 the DataPortal_Create may also return a Task and be called asynchronously.
The process of setting Initial values may also require variables from Csla.ApplicationContext.
So the test for DataPortal_Create should:
Copyright (c) Marimer LLC