hydrologics/Oasis.Base — Issue #45: Why is Add.Node failing in tests?
Author: johnmetta
Created: 2011-12-23 21:05:30+00:00
State: open

Location:

https://github.com/hydrologics/Oasis.Base/blob/master/Oasis.Repository.Tests/RepositoryTest.cs#L133

Exception:
Test method Oasis.Repository.Tests.RepositoryTest.AddTest threw exception:
System.Data.UpdateException: Entities in 'ObjectModelContainer.NodeBases' participate in the 'ReservoirNodeSAEInputSource' relationship. 0 related 'StorageAreaElevationInputSource' were found. 1 'StorageAreaElevationInputSource' is expected.

StackTrace:

System.Data.Mapping.Update.Internal.UpdateTranslator.RelationshipConstraintValidator.ValidateConstraints()
System.Data.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
System.Data.Objects.ObjectContext.SaveChanges()
Oasis.DataModel.EFUnitOfWork.Commit() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Oasis.Base\Oasis.DataModel\DataContext\EFUnitOfWork.cs: line 44
Oasis.Repository.NodeBaseRepository`1.Save() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Oasis.Base\Oasis.Repository\Repositories\NodeBaseRepository.cs: line 161
Oasis.Repository.Tests.RepositoryTest.AddTest() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Oasis.Base\Oasis.Repository.Tests\RepositoryTest.cs: line 145

No idea why this is failing, because it looks like 'sae' is a valid StorageAreaElevationInputSource. Could use another set of eyes on this one.