I'm using JustMock and AutoFac and trying to mock an array of a quite simple objects but I just can't seem to get the syntax right...
var labResults = Mock.Create<LabResult[]>();
Mock.Arrange(() => labResults).Returns(new LabResult[]
{
new LabResult
{
EstablishmentID = "0101",
PatientID = "A11111111",
EpisodeNo = 1,
LabNumber = "975310A",
Status = LabResultStatus.Initial,
TestCode = "ABCD",
DateUpdated = DateTime.Now
},
< snip >
new LabResult
{
EstablishmentID = "0101",
PatientID = "A11111112",
EpisodeNo = 1,
LabNumber = "975310A",
Status = LabResultStatus.Final,
TestCode = "ABC",
DateUpdated = DateTime.Now
},
});
The code compiles fine but when run gives me a 'System.ArgumentException' error on the Mock.Create call - 'Additional information: Value was invalid'.
This one's had me stumped all morning and I cannot find a suitable example anywhere. Can someone please tell me the correct syntax - it needs to be an array that comes back, not a List.
Cheers
Aucun commentaire:
Enregistrer un commentaire