The type initializer for 'ProjectTracker.DalMock.MockDb' threw an exception.

The type initializer for 'ProjectTracker.DalMock.MockDb' threw an exception.

Old forum URL: forums.lhotka.net/forums/t/11281.aspx


gbetz posted on Wednesday, April 04, 2012

trying to use MockDb. here is the code:

 

 

 

 

 

 

 

public List<ProjectDto

> Fetch()

{

 

 

 

var result = from r in ProjectTracker.DalMock.MockDb

.Projects

 

 

 

select new

ProjectDto

{

Id = r.Id,

Name = r.Name,

Description = r.Description,

ParentID = r.ParentID,

Alias = r.Alias,

CapitalizationStage = r.CapitalizationStage,

Viability = r.Viability

};

 For some reason ProjectTracker.DalMock.MockDb.Projects throws the exception even though static constructor creates the list like so:

Projects = 

 

 

};

what is wrong here?

 

new List<ProjectData> { new ProjectData { Id = 1, Name = "Update ProjectTracker", Description = "Update ProjectTracker for CSLA 4", Started = new DateTime(2011, 3, 22), LastChanged = GetTimeStamp(),Alias = "blah", CapitalizationStage ="One", Viability = true, ParentID = 1 }

Copyright (c) Marimer LLC