The method below fails on the line marked in bold and I receive an object reference error. I know that this is a common error but, I've tried changing several assignments to ensure they match up with the required types and it the method still fails.
I also tried:
Expand|Select|Wrap|Line Numbers
- agentResponse(0).InputData = testMetaDataArray
Just for extra information:
MetaDataResponseSet is an array type and is what is required by the AgentResponseToDTO() method.
MetaDataGroup is also an array type which has various properties, the only two I need to assign to are .Name and .Size
Expand|Select|Wrap|Line Numbers
- Public Sub TestAgentResponseToDTOResponseFieldSize2()
- Dim agentResponse(0) As MetaDataResponseSet
- ''Create a MetaDataGroup object that can store 2 items
- Dim testMetaDataArray(1) As MetaDataGroup
- Dim mdaObject1 As MetaDataGroup = New MetaDataGroup()
- mdaObject1.Name = "my name"
- mdaObject1.Size = 3
- Dim mdaObject2 As MetaDataGroup = New MetaDataGroup()
- mdaObject2.Name = "is Mathieu"
- mdaObject2.Size = 6
- testMetaDataArray(0) = mdaObject1
- testMetaDataArray(1) = mdaObject2
- 'testMetaDataArray(0).Name = "my name"
- 'testMetaDataArray(0).Size = 3
- agentResponse(0).InputData() = testMetaDataArray '' fails here
- '' Create a result object
- Dim result As Boolean = True
- Dim assemblerResponse = ExperianBankValMetaDataCallAssembler.AgentResponseToDTO(agentResponse)
- Assert.AreEqual(agentResponse(0).InputData(0).Size, assemblerResponse.InputFields(0).Length)
- Assert.AreEqual(agentResponse(0).InputData(0).Name, assemblerResponse.InputFields(0).Name)
- Assert.AreEqual(agentResponse(0).InputData(1).Size, assemblerResponse.InputFields(1).Length)
- Assert.AreEqual(agentResponse(0).InputData(1).Name, assemblerResponse.InputFields(1).Name)
- Assert.AreEqual(result, assemblerResponse.Result.Success)
- End Sub
Can anyone see where I've gone wrong?
Thank, Matt