API when creating page data used for tests

Some context: when using an in memory implementation of IContentRepository (most likely in a test scenario) you need to create pages that are involved in the tests. I’m not quite sure which approach I fancy so I thought I’d ask you. Given that these two snippets produces the same result, do you find one “better” (be it that it’s easier to understand, easier to write or something else) than the other?

_oldParent = ContentRepository.GetDefaultPageData<StartPage>(_startPage.PageLink);
_oldParent.PageName = "OldParent";
_oldParent.LinkURL = "oldparent";
ContentRepository.Save(_oldParent, SaveAction.Publish, AccessLevel.NoAccess);
_oldParent = ContentRepository
    .With(p =>
            p.PageName = "OldParent";
            p.LinkURL = "oldparent";
  • http://tedgustaf.com Ted Nyberg

    I prefer the fluent syntax, but I think the first option will appear more intuitive to most people (because of old habit)?

  • davidknipe

    I’m with Ted on this one, fluent for me. I think the fluent syntax makes the page properties stand out more, which will be important when writing tests?