Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Connection string for Entity Framework project
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01530977
Message ID:
01530981
Vues:
53
Navneet,

>Just created the EF project and then the test project using VS2010 build in Testing tool.
>
>Getting the following message when running the test method "GetOrderDetail":
>
>System.NullReferenceException was unhandled by user code
> Message=Object reference not set to an instance of an object.
> Source=OakLeaf.MM2010.Framework
> StackTrace:
> at OakLeaf.MM.Main.mmAppBase.get_DatabaseMgr()
> at OakLeaf.MM.Main.Business.mmBusinessObject.GetDataAccessObject(String databaseKey, Boolean localDataAccessObject)
> at OakLeaf.MM.Main.Business.mmBusinessObject.GetDataAccessObject(String databaseKey)
> at OakLeaf.MM.Main.Business.mmBusinessObject.GetDataAccessObject()
> at OakLeaf.MM.Main.Business.mmBusinessObjectHelperEF.GetEntityList[T,EntityType](IQueryable`1 objectQuery, MergeOption mergeOption, Boolean isSecondaryList, mmBusinessObjectGeneric`1 businessObject)
> at OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.GetEntityList[T](IQueryable`1 objectQuery, MergeOption mergeOption, Boolean isSecondaryList)
> at OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.GetEntityList[T](IQueryable`1 objectQuery, MergeOption mergeOption)
> at OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.GetEntityList(IQueryable`1 objectQuery)
> at ACME.OrderSystem.BusinessEF.OrderDetail.GetOrderDetail(Nullable`1 orderID) in C:\mm.netJumpStart\Order System BO EF\OrderDetail\OrderDetail.Partial.cs:line 48
> at TestProject1.UnitTest1.TestGetOrderDetailByOrderID() in c:\mm.netJumpStart\TestProject1\UnitTest1.cs:line 68
> InnerException:

When running unit tests, you need to set up your environment by instantiating an instance of the AAppTestFactory class (located in the AAppTest file) using the following code:
mmAppBase.Factory = new AAppTestFactory();
mmAppBase.IsRunning = true;
Only after doing this can you call the methods on your business objects.

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform