Skip to content

The second call to WithViewData throws NullReferenceException #40

Description

@milichev

This code:

            const string pageName = "pageName";

            _sut.GetByPageName(pageName)
                .Should()
                .BeViewResult()
                .WithViewData("PageName", pageName)
                .WithViewData("Roles", _roles) // this call fails!
                .WithViewData("FieldName", null);

causes:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=FluentAssertions.Mvc5
  StackTrace:
   at FluentAssertions.Mvc.ViewResultBaseAssertions`1.WithViewData(String key, Object expectedValue, String reason, Object[] reasonArgs)
   at Tests.Controllers.HelpEditor.HelpEditorControllerTest.GetByPageName_Should_return_view_for_specified_pageName() in ...\....Tests\Controllers\HelpEditor\HelpEditorControllerTest.cs:line 48

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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