StrataFrame Forum

Testing BO using MbUnit/NUnit

http://forum.strataframe.net/Topic9632.aspx

By Chan - 6/16/2007

Hi,

I am trying to writing test case to test my BO logic using MbUnit/NUnit.



Currently, I hit DataLayerException as below. May I know how to run test on my BO successully? Do you have any test project template?



Thank you



Message: An error occurred while creating a new DataLayer for the business object.



Type: MicroFour.StrataFrame.Data.DataLayerException

Source: MicroFour StrataFrame Business

TargetSite: MicroFour.StrataFrame.Data.DataLayer get__DataLayer()

HelpLink: null

Stack: at MicroFour.StrataFrame.Business.BusinessLayer.get__DataLayer()

at MicroFour.StrataFrame.Business.BusinessLayer.GetDataTable(DbCommand CommandToExecute)

at JK.Inventory.Product.BusinessObject.ItemPricesBO.GetDataTableByItemID(Guid ItemID, DateTime AsAtDate) in F:\Projects\Inventory\InventoryBusinessObject\Product\ItemPricesBO.cs:line 85

at JK.Inventory.Product.BusinessObject.ItemPricesBO.GetPrice(Guid ItemID, DateTime AsAtDate) in F:\Projects\Inventory\InventoryBusinessObject\Product\ItemPricesBO.cs:line 63

at JK.Inventory.Product.BusinessObject.ItemPricesBO.GetPrice(Guid ItemID) in F:\Projects\Inventory\InventoryBusinessObject\Product\ItemPricesBO.cs:line 56

at TestItemPricesBO.TestItemPricesBO.TestGetPriceByItemID() in F:\Projects\Inventory\Test\TestItemPricesBO\TestItemPricesBO\TestItemPricesBO\TestItemPricesBO.cs:line 26
By Trent L. Taylor - 6/18/2007

There is not a test template as this would really change from each test platform and since each test environment is so different this would not be very conducive to a template.  The message you posted doesn't really give to inner exception as to what is going on.  You can turn on debug mode during testing just like you can when running through a runtime test to have an HTML log produced with all of the query information.  Using the posted stack trace, though, I cannot tell you exactly what you are running into....by first guess would be that you do not have a connection specified for the BO so the DAL cannot be created.