Skip to content

Agent using Properties got an NullReferenceException #48

@shadowca

Description

@shadowca

Hi
i try to get the model under test for testing the serialization. So I use the Set - Methods like "SetAccount" and I use the Properties directly. It will caused an Exception.

var agent = new Agent();
agent.Accounts.Add(CreateOnlineAccount());
agent.Addresses.Add(CreateAddress());
agent.Emails.Add(CreateRessource());
agent.Homepage = CreateRessource();
agent.Identifiers.Add(CreateIdentifier());
agent.Names.Add(CreateTextValue());
agent.Openid = CreateRessource();
agent.Phones.Add(CreateRessource());
agent.Id = "id";
agent.Links.Add(CreateLink());

Why the error happened is clear to me, but why was it realized so? Can not you simply initialize the properties and remove the methods?

I have fixed the issue in #43 but if this have a deeper meaning I would be glad to learn it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions